iOS Swift Conversion (#2527)
Converts iOS implementation from Objective-c to Swift # During the conversion process some updates to the code structure were also made - Modularize codebase from single file to smaller focused files - Untangled large nested IF statements - Added more null checks, since Swift is more strict with null pointers - Added property to allow for decoding of local video sources with self contained key for offline playback - Updates example apps to test react-native 0.63.4 and uses auto native dependency imports for android and ios
This commit is contained in:
@@ -48,16 +48,17 @@ class VideoPlayer extends Component {
|
||||
seekerWidth = 0
|
||||
|
||||
srcList = [
|
||||
require('./broadchurch.mp4'),
|
||||
{
|
||||
description: 'subtitles',
|
||||
uri: 'https://bitmovin-a.akamaihd.net/content/sintel/sintel.mpd',
|
||||
},
|
||||
{
|
||||
description: 'demo with sintel Subtitles',
|
||||
uri:
|
||||
'http://www.youtube.com/api/manifest/dash/id/bf5bb2419360daf1/source/youtube?as=fmp4_audio_clear,fmp4_sd_hd_clear&sparams=ip,ipbits,expire,source,id,as&ip=0.0.0.0&ipbits=0&expire=19000000000&signature=51AF5F39AB0CEC3E5497CD9C900EBFEAECCCB5C7.8506521BFC350652163895D4C26DEE124209AA9E&key=ik0',
|
||||
type: 'mpd',
|
||||
},
|
||||
{
|
||||
description: 'subtitles',
|
||||
uri: 'https://bitmovin-a.akamaihd.net/content/sintel/sintel.mpd',
|
||||
},
|
||||
{ description: 'Stopped playback', uri: undefined },
|
||||
{
|
||||
description: 'no View',
|
||||
@@ -521,7 +522,7 @@ class VideoPlayer extends Component {
|
||||
{this.IndicatorLoadingView()}
|
||||
<View style={styles.topControls}>
|
||||
<Text style={[styles.controlOption]}>
|
||||
{this.srcList[this.state.srcListId]?.description}
|
||||
{this.srcList[this.state.srcListId]?.description || 'local file'}
|
||||
</Text>
|
||||
</View>
|
||||
<View style={styles.leftControls}>
|
||||
@@ -814,4 +815,4 @@ const styles = StyleSheet.create({
|
||||
},
|
||||
});
|
||||
|
||||
export default VideoPlayer
|
||||
export default VideoPlayer
|
@@ -4,7 +4,7 @@ import React, {
|
||||
} from 'react';
|
||||
|
||||
import {
|
||||
AlertIOS,
|
||||
Alert,
|
||||
Platform,
|
||||
StyleSheet,
|
||||
Text,
|
||||
@@ -187,7 +187,7 @@ class VideoPlayer extends Component {
|
||||
onLoad={this.onLoad}
|
||||
onBuffer={this.onBuffer}
|
||||
onProgress={this.onProgress}
|
||||
onEnd={() => { AlertIOS.alert('Done!') }}
|
||||
onEnd={() => { Alert.alert('Done!') }}
|
||||
repeat={true}
|
||||
filter={this.state.filter}
|
||||
filterEnabled={this.state.filterEnabled}
|
||||
@@ -281,7 +281,7 @@ class VideoPlayer extends Component {
|
||||
onLoad={this.onLoad}
|
||||
onBuffer={this.onBuffer}
|
||||
onProgress={this.onProgress}
|
||||
onEnd={() => { AlertIOS.alert('Done!') }}
|
||||
onEnd={() => { Alert.alert('Done!') }}
|
||||
repeat={true}
|
||||
controls={this.state.controls}
|
||||
filter={this.state.filter}
|
||||
@@ -450,4 +450,4 @@ const styles = StyleSheet.create({
|
||||
justifyContent: 'center',
|
||||
},
|
||||
});
|
||||
export default VideoPlayer
|
||||
export default VideoPlayer
|
@@ -212,4 +212,4 @@ const styles = StyleSheet.create({
|
||||
justifyContent: 'center',
|
||||
},
|
||||
});
|
||||
export default VideoPlayer
|
||||
export default VideoPlayer
|
@@ -1,5 +1,5 @@
|
||||
import {AppRegistry} from 'react-native';
|
||||
import VideoPlayer from './VideoPlayer';
|
||||
import {name as appName} from '../app.json';
|
||||
|
||||
import { AppRegistry } from 'react-native';
|
||||
|
||||
AppRegistry.registerComponent('VideoPlayer', () => VideoPlayer);
|
||||
AppRegistry.registerComponent(appName, () => VideoPlayer);
|
||||
|
Reference in New Issue
Block a user