Revert "[Video] Download videos" (#4945)

This commit is contained in:
Hailey 2024-08-15 16:29:16 -07:00 committed by GitHub
parent b6e515c664
commit a5af24b53b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 3 additions and 747 deletions

View file

@ -1,17 +1,12 @@
import React from 'react'
import {ScrollView, View} from 'react-native'
import {deleteAsync} from 'expo-file-system'
import {saveToLibraryAsync} from 'expo-media-library'
import {useSetThemePrefs} from '#/state/shell'
import {useVideoLibraryPermission} from 'lib/hooks/usePermissions'
import {isIOS, isWeb} from 'platform/detection'
import {isWeb} from 'platform/detection'
import {CenteredView} from '#/view/com/util/Views'
import * as Toast from 'view/com/util/Toast'
import {ListContained} from 'view/screens/Storybook/ListContained'
import {atoms as a, ThemeProvider, useTheme} from '#/alf'
import {Button, ButtonText} from '#/components/Button'
import {HLSDownloadView} from '../../../../modules/expo-bluesky-swiss-army'
import {Breakpoints} from './Breakpoints'
import {Buttons} from './Buttons'
import {Dialogs} from './Dialogs'
@ -38,49 +33,10 @@ function StorybookInner() {
const t = useTheme()
const {setColorMode, setDarkTheme} = useSetThemePrefs()
const [showContainedList, setShowContainedList] = React.useState(false)
const hlsDownloadRef = React.useRef<HLSDownloadView>(null)
const {requestVideoAccessIfNeeded} = useVideoLibraryPermission()
return (
<CenteredView style={[t.atoms.bg]}>
<View style={[a.p_xl, a.gap_5xl, {paddingBottom: 100}]}>
<HLSDownloadView
ref={hlsDownloadRef}
downloaderUrl={
isIOS
? 'http://localhost:19006/video-download'
: 'http://10.0.2.2:19006/video-download'
}
onSuccess={async e => {
const uri = e.nativeEvent.uri
const permsRes = await requestVideoAccessIfNeeded()
if (!permsRes) return
await saveToLibraryAsync(uri)
try {
deleteAsync(uri)
} catch (err) {
console.error('Failed to delete file', err)
}
Toast.show('Video saved to library')
}}
onStart={() => console.log('Download is starting')}
onError={e => console.log(e.nativeEvent.message)}
onProgress={e => console.log(e.nativeEvent.progress)}
/>
<Button
variant="solid"
color="primary"
size="small"
onPress={async () => {
hlsDownloadRef.current?.startDownloadAsync(
'https://lumi.jazco.dev/watch/did:plc:q6gjnaw2blty4crticxkmujt/Qmc8w93UpTa2adJHg4ZhnDPrBs1EsbzrekzPcqF5SwusuZ/playlist.m3u8?download=true',
)
}}
label="Video download test">
<ButtonText>Video download test</ButtonText>
</Button>
{!showContainedList ? (
<>
<View style={[a.flex_row, a.align_start, a.gap_md]}>