fix: ensure save doesn't crash on android (#3415)
Co-authored-by: olivier <olivier.bouillet@ifeelsmart.com>
This commit is contained in:
parent
2462800c9a
commit
22a2655dca
@ -644,12 +644,13 @@ class VideoPlayer extends Component {
|
|||||||
onPress={this.onResizeModeSelected}
|
onPress={this.onResizeModeSelected}
|
||||||
selected={this.state.resizeMode}
|
selected={this.state.resizeMode}
|
||||||
/>
|
/>
|
||||||
|
{Platform.OS === 'ios' ? (
|
||||||
<ToggleControl
|
<ToggleControl
|
||||||
isSelected={this.state.paused}
|
isSelected={this.state.paused}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
this.video
|
this.video
|
||||||
?.save({})
|
?.save({})
|
||||||
.then(response => {
|
?.then(response => {
|
||||||
console.log('Downloaded URI', response);
|
console.log('Downloaded URI', response);
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
@ -658,6 +659,7 @@ class VideoPlayer extends Component {
|
|||||||
}}
|
}}
|
||||||
text="save"
|
text="save"
|
||||||
/>
|
/>
|
||||||
|
) : null}
|
||||||
</View>
|
</View>
|
||||||
{this.renderSeekBar()}
|
{this.renderSeekBar()}
|
||||||
<View style={styles.generalControls}>
|
<View style={styles.generalControls}>
|
||||||
|
@ -243,7 +243,8 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
|
|||||||
}, [setIsFullscreen]);
|
}, [setIsFullscreen]);
|
||||||
|
|
||||||
const save = useCallback((options: object) => {
|
const save = useCallback((options: object) => {
|
||||||
return VideoManager.save(options, getReactTag(nativeRef));
|
// VideoManager.save can be null on android & windows
|
||||||
|
return VideoManager.save?.(options, getReactTag(nativeRef));
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const pause = useCallback(() => {
|
const pause = useCallback(() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user