[CLEAN] Cleanup useless code
This commit is contained in:
parent
c8f4524a9d
commit
915e31a874
@ -19,18 +19,15 @@ import com.google.android.exoplayer2.PlaybackParameters;
|
|||||||
import com.google.android.exoplayer2.Player;
|
import com.google.android.exoplayer2.Player;
|
||||||
import com.google.android.exoplayer2.ExoPlayer;
|
import com.google.android.exoplayer2.ExoPlayer;
|
||||||
import com.google.android.exoplayer2.Timeline;
|
import com.google.android.exoplayer2.Timeline;
|
||||||
import com.google.android.exoplayer2.ext.ima.ImaAdsLoader;
|
|
||||||
import com.google.android.exoplayer2.Tracks;
|
import com.google.android.exoplayer2.Tracks;
|
||||||
import com.google.android.exoplayer2.text.Cue;
|
import com.google.android.exoplayer2.text.Cue;
|
||||||
import com.google.android.exoplayer2.trackselection.TrackSelectionArray;
|
import com.google.android.exoplayer2.trackselection.TrackSelectionArray;
|
||||||
import com.google.android.exoplayer2.ui.AdViewProvider;
|
import com.google.android.exoplayer2.ui.AdViewProvider;
|
||||||
import com.google.android.exoplayer2.ui.AdOverlayInfo;
|
|
||||||
import com.google.android.exoplayer2.ui.SubtitleView;
|
import com.google.android.exoplayer2.ui.SubtitleView;
|
||||||
import com.google.android.exoplayer2.util.Assertions;
|
import com.google.android.exoplayer2.util.Assertions;
|
||||||
import com.google.android.exoplayer2.video.VideoSize;
|
import com.google.android.exoplayer2.video.VideoSize;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
@TargetApi(16)
|
@TargetApi(16)
|
||||||
public final class ExoPlayerView extends FrameLayout implements AdViewProvider {
|
public final class ExoPlayerView extends FrameLayout implements AdViewProvider {
|
||||||
|
@ -103,7 +103,6 @@ import com.google.common.collect.ImmutableList;
|
|||||||
import java.net.CookieHandler;
|
import java.net.CookieHandler;
|
||||||
import java.net.CookieManager;
|
import java.net.CookieManager;
|
||||||
import java.net.CookiePolicy;
|
import java.net.CookiePolicy;
|
||||||
import java.net.URI;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@ -622,7 +621,6 @@ class ReactExoplayerView extends FrameLayout implements
|
|||||||
new DefaultRenderersFactory(getContext())
|
new DefaultRenderersFactory(getContext())
|
||||||
.setExtensionRendererMode(DefaultRenderersFactory.EXTENSION_RENDERER_MODE_OFF);
|
.setExtensionRendererMode(DefaultRenderersFactory.EXTENSION_RENDERER_MODE_OFF);
|
||||||
|
|
||||||
Log.d("MEDIAAA", mediaDataSourceFactory.toString());
|
|
||||||
MediaSource.Factory mediaSourceFactory = new DefaultMediaSourceFactory(mediaDataSourceFactory)
|
MediaSource.Factory mediaSourceFactory = new DefaultMediaSourceFactory(mediaDataSourceFactory)
|
||||||
.setLocalAdInsertionComponents(unusedAdTagUri -> adsLoader, exoPlayerView);
|
.setLocalAdInsertionComponents(unusedAdTagUri -> adsLoader, exoPlayerView);
|
||||||
|
|
||||||
@ -638,7 +636,7 @@ class ReactExoplayerView extends FrameLayout implements
|
|||||||
audioBecomingNoisyReceiver.setListener(self);
|
audioBecomingNoisyReceiver.setListener(self);
|
||||||
bandwidthMeter.addEventListener(new Handler(), self);
|
bandwidthMeter.addEventListener(new Handler(), self);
|
||||||
setPlayWhenReady(!isPaused);
|
setPlayWhenReady(!isPaused);
|
||||||
playerNeedsSource = false;
|
playerNeedsSource = true;
|
||||||
|
|
||||||
PlaybackParameters params = new PlaybackParameters(rate, 1f);
|
PlaybackParameters params = new PlaybackParameters(rate, 1f);
|
||||||
player.setPlaybackParameters(params);
|
player.setPlaybackParameters(params);
|
||||||
@ -986,6 +984,7 @@ class ReactExoplayerView extends FrameLayout implements
|
|||||||
case AudioManager.AUDIOFOCUS_LOSS:
|
case AudioManager.AUDIOFOCUS_LOSS:
|
||||||
this.hasAudioFocus = false;
|
this.hasAudioFocus = false;
|
||||||
eventEmitter.audioFocusChanged(false);
|
eventEmitter.audioFocusChanged(false);
|
||||||
|
pausePlayback();
|
||||||
audioManager.abandonAudioFocus(this);
|
audioManager.abandonAudioFocus(this);
|
||||||
break;
|
break;
|
||||||
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT:
|
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT:
|
||||||
|
@ -1,236 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
import React, {
|
|
||||||
Component
|
|
||||||
} from 'react';
|
|
||||||
|
|
||||||
import {
|
|
||||||
AppRegistry,
|
|
||||||
StyleSheet,
|
|
||||||
Text,
|
|
||||||
TouchableOpacity,
|
|
||||||
View,
|
|
||||||
} from 'react-native';
|
|
||||||
|
|
||||||
import Video from 'react-native-video';
|
|
||||||
|
|
||||||
const adTagUrl = "https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/"
|
|
||||||
+ "ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp"
|
|
||||||
+ "&output=vmap&unviewed_position_start=1&cust_params=deployment%3Ddevsite"
|
|
||||||
+ "%26sample_ar%3Dpremidpost&cmsid=496&vid=short_onecue&correlator=";
|
|
||||||
|
|
||||||
class VideoPlayer extends Component {
|
|
||||||
|
|
||||||
state = {
|
|
||||||
rate: 1,
|
|
||||||
volume: 1,
|
|
||||||
muted: false,
|
|
||||||
resizeMode: 'contain',
|
|
||||||
duration: 0.0,
|
|
||||||
currentTime: 0.0,
|
|
||||||
paused: true,
|
|
||||||
};
|
|
||||||
|
|
||||||
video: Video;
|
|
||||||
|
|
||||||
onLoad = (data) => {
|
|
||||||
this.setState({ duration: data.duration });
|
|
||||||
};
|
|
||||||
|
|
||||||
onProgress = (data) => {
|
|
||||||
this.setState({ currentTime: data.currentTime });
|
|
||||||
};
|
|
||||||
|
|
||||||
onEnd = () => {
|
|
||||||
this.setState({ paused: true })
|
|
||||||
this.video.seek(0)
|
|
||||||
};
|
|
||||||
|
|
||||||
onAudioBecomingNoisy = () => {
|
|
||||||
this.setState({ paused: true })
|
|
||||||
};
|
|
||||||
|
|
||||||
onAudioFocusChanged = (event: { hasAudioFocus: boolean }) => {
|
|
||||||
this.setState({ paused: !event.hasAudioFocus })
|
|
||||||
};
|
|
||||||
|
|
||||||
getCurrentTimePercentage() {
|
|
||||||
if (this.state.currentTime > 0) {
|
|
||||||
return parseFloat(this.state.currentTime) / parseFloat(this.state.duration);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
renderRateControl(rate) {
|
|
||||||
const isSelected = (this.state.rate === rate);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<TouchableOpacity onPress={() => { this.setState({ rate }) }}>
|
|
||||||
<Text style={[styles.controlOption, { fontWeight: isSelected ? 'bold' : 'normal' }]}>
|
|
||||||
{rate}x
|
|
||||||
</Text>
|
|
||||||
</TouchableOpacity>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
renderResizeModeControl(resizeMode) {
|
|
||||||
const isSelected = (this.state.resizeMode === resizeMode);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<TouchableOpacity onPress={() => { this.setState({ resizeMode }) }}>
|
|
||||||
<Text style={[styles.controlOption, { fontWeight: isSelected ? 'bold' : 'normal' }]}>
|
|
||||||
{resizeMode}
|
|
||||||
</Text>
|
|
||||||
</TouchableOpacity>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
renderVolumeControl(volume) {
|
|
||||||
const isSelected = (this.state.volume === volume);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<TouchableOpacity onPress={() => { this.setState({ volume }) }}>
|
|
||||||
<Text style={[styles.controlOption, { fontWeight: isSelected ? 'bold' : 'normal' }]}>
|
|
||||||
{volume * 100}%
|
|
||||||
</Text>
|
|
||||||
</TouchableOpacity>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const flexCompleted = this.getCurrentTimePercentage() * 100;
|
|
||||||
const flexRemaining = (1 - this.getCurrentTimePercentage()) * 100;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<View style={styles.container}>
|
|
||||||
<TouchableOpacity
|
|
||||||
style={styles.fullScreen}
|
|
||||||
onPress={() => this.setState({ paused: !this.state.paused })}
|
|
||||||
>
|
|
||||||
<Video
|
|
||||||
ref={(ref: Video) => { this.video = ref }}
|
|
||||||
/* For ExoPlayer */
|
|
||||||
/* source={{ 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' }} */
|
|
||||||
source={require('./broadchurch.mp4')}
|
|
||||||
style={styles.fullScreen}
|
|
||||||
rate={this.state.rate}
|
|
||||||
paused={this.state.paused}
|
|
||||||
volume={this.state.volume}
|
|
||||||
muted={this.state.muted}
|
|
||||||
resizeMode={this.state.resizeMode}
|
|
||||||
onLoad={this.onLoad}
|
|
||||||
onProgress={this.onProgress}
|
|
||||||
onEnd={this.onEnd}
|
|
||||||
onAudioBecomingNoisy={this.onAudioBecomingNoisy}
|
|
||||||
onAudioFocusChanged={this.onAudioFocusChanged}
|
|
||||||
repeat={false}
|
|
||||||
adTagUrl={adTagUrl}
|
|
||||||
/>
|
|
||||||
</TouchableOpacity>
|
|
||||||
|
|
||||||
<View style={styles.controls}>
|
|
||||||
<View style={styles.generalControls}>
|
|
||||||
<View style={styles.rateControl}>
|
|
||||||
{this.renderRateControl(0.25)}
|
|
||||||
{this.renderRateControl(0.5)}
|
|
||||||
{this.renderRateControl(1.0)}
|
|
||||||
{this.renderRateControl(1.5)}
|
|
||||||
{this.renderRateControl(2.0)}
|
|
||||||
</View>
|
|
||||||
|
|
||||||
<View style={styles.volumeControl}>
|
|
||||||
{this.renderVolumeControl(0.5)}
|
|
||||||
{this.renderVolumeControl(1)}
|
|
||||||
{this.renderVolumeControl(1.5)}
|
|
||||||
</View>
|
|
||||||
|
|
||||||
<View style={styles.resizeModeControl}>
|
|
||||||
{this.renderResizeModeControl('cover')}
|
|
||||||
{this.renderResizeModeControl('contain')}
|
|
||||||
{this.renderResizeModeControl('stretch')}
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
<View style={styles.trackingControls}>
|
|
||||||
<View style={styles.progress}>
|
|
||||||
<View style={[styles.innerProgressCompleted, { flex: flexCompleted }]} />
|
|
||||||
<View style={[styles.innerProgressRemaining, { flex: flexRemaining }]} />
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
|
||||||
container: {
|
|
||||||
flex: 1,
|
|
||||||
justifyContent: 'center',
|
|
||||||
alignItems: 'center',
|
|
||||||
backgroundColor: 'black',
|
|
||||||
},
|
|
||||||
fullScreen: {
|
|
||||||
position: 'absolute',
|
|
||||||
top: 0,
|
|
||||||
left: 0,
|
|
||||||
bottom: 0,
|
|
||||||
right: 0,
|
|
||||||
},
|
|
||||||
controls: {
|
|
||||||
backgroundColor: 'transparent',
|
|
||||||
borderRadius: 5,
|
|
||||||
position: 'absolute',
|
|
||||||
bottom: 20,
|
|
||||||
left: 20,
|
|
||||||
right: 20,
|
|
||||||
},
|
|
||||||
progress: {
|
|
||||||
flex: 1,
|
|
||||||
flexDirection: 'row',
|
|
||||||
borderRadius: 3,
|
|
||||||
overflow: 'hidden',
|
|
||||||
},
|
|
||||||
innerProgressCompleted: {
|
|
||||||
height: 20,
|
|
||||||
backgroundColor: '#cccccc',
|
|
||||||
},
|
|
||||||
innerProgressRemaining: {
|
|
||||||
height: 20,
|
|
||||||
backgroundColor: '#2C2C2C',
|
|
||||||
},
|
|
||||||
generalControls: {
|
|
||||||
flex: 1,
|
|
||||||
flexDirection: 'row',
|
|
||||||
borderRadius: 4,
|
|
||||||
overflow: 'hidden',
|
|
||||||
paddingBottom: 10,
|
|
||||||
},
|
|
||||||
rateControl: {
|
|
||||||
flex: 1,
|
|
||||||
flexDirection: 'row',
|
|
||||||
justifyContent: 'center',
|
|
||||||
},
|
|
||||||
volumeControl: {
|
|
||||||
flex: 1,
|
|
||||||
flexDirection: 'row',
|
|
||||||
justifyContent: 'center',
|
|
||||||
},
|
|
||||||
resizeModeControl: {
|
|
||||||
flex: 1,
|
|
||||||
flexDirection: 'row',
|
|
||||||
alignItems: 'center',
|
|
||||||
justifyContent: 'center',
|
|
||||||
},
|
|
||||||
controlOption: {
|
|
||||||
alignSelf: 'center',
|
|
||||||
fontSize: 11,
|
|
||||||
color: 'white',
|
|
||||||
paddingLeft: 2,
|
|
||||||
paddingRight: 2,
|
|
||||||
lineHeight: 12,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
AppRegistry.registerComponent('VideoPlayer', () => VideoPlayer);
|
|
@ -1,455 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
import React, {
|
|
||||||
Component
|
|
||||||
} from 'react';
|
|
||||||
|
|
||||||
import {
|
|
||||||
Alert,
|
|
||||||
AppRegistry,
|
|
||||||
Platform,
|
|
||||||
StyleSheet,
|
|
||||||
Text,
|
|
||||||
TouchableOpacity,
|
|
||||||
View,
|
|
||||||
} from 'react-native';
|
|
||||||
|
|
||||||
import Video,{FilterType} from 'react-native-video';
|
|
||||||
|
|
||||||
const adTagUrl = "https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/"
|
|
||||||
+ "ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp"
|
|
||||||
+ "&output=vmap&unviewed_position_start=1&cust_params=deployment%3Ddevsite"
|
|
||||||
+ "%26sample_ar%3Dpremidpost&cmsid=496&vid=short_onecue&correlator=";
|
|
||||||
|
|
||||||
const filterTypes = [
|
|
||||||
FilterType.NONE,
|
|
||||||
FilterType.INVERT,
|
|
||||||
FilterType.MONOCHROME,
|
|
||||||
FilterType.POSTERIZE,
|
|
||||||
FilterType.FALSE,
|
|
||||||
FilterType.MAXIMUMCOMPONENT,
|
|
||||||
FilterType.MINIMUMCOMPONENT,
|
|
||||||
FilterType.CHROME,
|
|
||||||
FilterType.FADE,
|
|
||||||
FilterType.INSTANT,
|
|
||||||
FilterType.MONO,
|
|
||||||
FilterType.NOIR,
|
|
||||||
FilterType.PROCESS,
|
|
||||||
FilterType.TONAL,
|
|
||||||
FilterType.TRANSFER,
|
|
||||||
FilterType.SEPIA
|
|
||||||
];
|
|
||||||
|
|
||||||
class VideoPlayer extends Component {
|
|
||||||
constructor(props) {
|
|
||||||
super(props);
|
|
||||||
this.onLoad = this.onLoad.bind(this);
|
|
||||||
this.onProgress = this.onProgress.bind(this);
|
|
||||||
this.onBuffer = this.onBuffer.bind(this);
|
|
||||||
}
|
|
||||||
state = {
|
|
||||||
rate: 1,
|
|
||||||
volume: 1,
|
|
||||||
muted: false,
|
|
||||||
resizeMode: 'contain',
|
|
||||||
duration: 0.0,
|
|
||||||
currentTime: 0.0,
|
|
||||||
controls: false,
|
|
||||||
paused: true,
|
|
||||||
skin: 'custom',
|
|
||||||
ignoreSilentSwitch: null,
|
|
||||||
mixWithOthers: null,
|
|
||||||
isBuffering: false,
|
|
||||||
filter: FilterType.NONE,
|
|
||||||
filterEnabled: true
|
|
||||||
};
|
|
||||||
|
|
||||||
onLoad(data) {
|
|
||||||
console.log('On load fired!');
|
|
||||||
this.setState({duration: data.duration});
|
|
||||||
}
|
|
||||||
|
|
||||||
onProgress(data) {
|
|
||||||
this.setState({currentTime: data.currentTime});
|
|
||||||
}
|
|
||||||
|
|
||||||
onBuffer({ isBuffering }: { isBuffering: boolean }) {
|
|
||||||
this.setState({ isBuffering });
|
|
||||||
}
|
|
||||||
|
|
||||||
getCurrentTimePercentage() {
|
|
||||||
if (this.state.currentTime > 0) {
|
|
||||||
return parseFloat(this.state.currentTime) / parseFloat(this.state.duration);
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setFilter(step) {
|
|
||||||
let index = filterTypes.indexOf(this.state.filter) + step;
|
|
||||||
|
|
||||||
if (index === filterTypes.length) {
|
|
||||||
index = 0;
|
|
||||||
} else if (index === -1) {
|
|
||||||
index = filterTypes.length - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.setState({
|
|
||||||
filter: filterTypes[index]
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
renderSkinControl(skin) {
|
|
||||||
const isSelected = this.state.skin == skin;
|
|
||||||
const selectControls = skin == 'native' || skin == 'embed';
|
|
||||||
return (
|
|
||||||
<TouchableOpacity onPress={() => { this.setState({
|
|
||||||
controls: selectControls,
|
|
||||||
skin: skin
|
|
||||||
}) }}>
|
|
||||||
<Text style={[styles.controlOption, {fontWeight: isSelected ? "bold" : "normal"}]}>
|
|
||||||
{skin}
|
|
||||||
</Text>
|
|
||||||
</TouchableOpacity>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
renderRateControl(rate) {
|
|
||||||
const isSelected = (this.state.rate == rate);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<TouchableOpacity onPress={() => { this.setState({rate: rate}) }}>
|
|
||||||
<Text style={[styles.controlOption, {fontWeight: isSelected ? "bold" : "normal"}]}>
|
|
||||||
{rate}x
|
|
||||||
</Text>
|
|
||||||
</TouchableOpacity>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
renderResizeModeControl(resizeMode) {
|
|
||||||
const isSelected = (this.state.resizeMode == resizeMode);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<TouchableOpacity onPress={() => { this.setState({resizeMode: resizeMode}) }}>
|
|
||||||
<Text style={[styles.controlOption, {fontWeight: isSelected ? "bold" : "normal"}]}>
|
|
||||||
{resizeMode}
|
|
||||||
</Text>
|
|
||||||
</TouchableOpacity>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
renderVolumeControl(volume) {
|
|
||||||
const isSelected = (this.state.volume == volume);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<TouchableOpacity onPress={() => { this.setState({volume: volume}) }}>
|
|
||||||
<Text style={[styles.controlOption, {fontWeight: isSelected ? "bold" : "normal"}]}>
|
|
||||||
{volume * 100}%
|
|
||||||
</Text>
|
|
||||||
</TouchableOpacity>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
renderIgnoreSilentSwitchControl(ignoreSilentSwitch) {
|
|
||||||
const isSelected = (this.state.ignoreSilentSwitch == ignoreSilentSwitch);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<TouchableOpacity onPress={() => { this.setState({ignoreSilentSwitch: ignoreSilentSwitch}) }}>
|
|
||||||
<Text style={[styles.controlOption, {fontWeight: isSelected ? "bold" : "normal"}]}>
|
|
||||||
{ignoreSilentSwitch}
|
|
||||||
</Text>
|
|
||||||
</TouchableOpacity>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
renderMixWithOthersControl(mixWithOthers) {
|
|
||||||
const isSelected = (this.state.mixWithOthers == mixWithOthers);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<TouchableOpacity onPress={() => { this.setState({mixWithOthers: mixWithOthers}) }}>
|
|
||||||
<Text style={[styles.controlOption, {fontWeight: isSelected ? "bold" : "normal"}]}>
|
|
||||||
{mixWithOthers}
|
|
||||||
</Text>
|
|
||||||
</TouchableOpacity>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
renderCustomSkin() {
|
|
||||||
const flexCompleted = this.getCurrentTimePercentage() * 100;
|
|
||||||
const flexRemaining = (1 - this.getCurrentTimePercentage()) * 100;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<View style={styles.container}>
|
|
||||||
<TouchableOpacity style={styles.fullScreen} onPress={() => {this.setState({paused: !this.state.paused})}}>
|
|
||||||
<Video
|
|
||||||
source={require('./broadchurch.mp4')}
|
|
||||||
style={styles.fullScreen}
|
|
||||||
rate={this.state.rate}
|
|
||||||
paused={this.state.paused}
|
|
||||||
volume={this.state.volume}
|
|
||||||
muted={this.state.muted}
|
|
||||||
ignoreSilentSwitch={this.state.ignoreSilentSwitch}
|
|
||||||
mixWithOthers={this.state.mixWithOthers}
|
|
||||||
resizeMode={this.state.resizeMode}
|
|
||||||
onLoad={this.onLoad}
|
|
||||||
onBuffer={this.onBuffer}
|
|
||||||
onProgress={this.onProgress}
|
|
||||||
onEnd={() => { Alert.alert('Done!') }}
|
|
||||||
repeat={true}
|
|
||||||
filter={this.state.filter}
|
|
||||||
filterEnabled={this.state.filterEnabled}
|
|
||||||
/>
|
|
||||||
</TouchableOpacity>
|
|
||||||
|
|
||||||
<View style={styles.controls}>
|
|
||||||
<View style={styles.generalControls}>
|
|
||||||
<View style={styles.skinControl}>
|
|
||||||
{this.renderSkinControl('custom')}
|
|
||||||
{this.renderSkinControl('native')}
|
|
||||||
{this.renderSkinControl('embed')}
|
|
||||||
</View>
|
|
||||||
{
|
|
||||||
(this.state.filterEnabled) ?
|
|
||||||
<View style={styles.skinControl}>
|
|
||||||
<TouchableOpacity onPress={() => {
|
|
||||||
this.setFilter(-1)
|
|
||||||
}}>
|
|
||||||
<Text style={styles.controlOption}>Previous Filter</Text>
|
|
||||||
</TouchableOpacity>
|
|
||||||
<TouchableOpacity onPress={() => {
|
|
||||||
this.setFilter(1)
|
|
||||||
}}>
|
|
||||||
<Text style={styles.controlOption}>Next Filter</Text>
|
|
||||||
</TouchableOpacity>
|
|
||||||
</View> : null
|
|
||||||
}
|
|
||||||
</View>
|
|
||||||
<View style={styles.generalControls}>
|
|
||||||
<View style={styles.rateControl}>
|
|
||||||
{this.renderRateControl(0.5)}
|
|
||||||
{this.renderRateControl(1.0)}
|
|
||||||
{this.renderRateControl(2.0)}
|
|
||||||
</View>
|
|
||||||
|
|
||||||
<View style={styles.volumeControl}>
|
|
||||||
{this.renderVolumeControl(0.5)}
|
|
||||||
{this.renderVolumeControl(1)}
|
|
||||||
{this.renderVolumeControl(1.5)}
|
|
||||||
</View>
|
|
||||||
|
|
||||||
<View style={styles.resizeModeControl}>
|
|
||||||
{this.renderResizeModeControl('cover')}
|
|
||||||
{this.renderResizeModeControl('contain')}
|
|
||||||
{this.renderResizeModeControl('stretch')}
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
<View style={styles.generalControls}>
|
|
||||||
{
|
|
||||||
(Platform.OS === 'ios') ?
|
|
||||||
<>
|
|
||||||
<View style={styles.ignoreSilentSwitchControl}>
|
|
||||||
{this.renderIgnoreSilentSwitchControl('ignore')}
|
|
||||||
{this.renderIgnoreSilentSwitchControl('obey')}
|
|
||||||
</View>
|
|
||||||
<View style={styles.mixWithOthersControl}>
|
|
||||||
{this.renderMixWithOthersControl('mix')}
|
|
||||||
{this.renderMixWithOthersControl('duck')}
|
|
||||||
</View>
|
|
||||||
</> : null
|
|
||||||
}
|
|
||||||
</View>
|
|
||||||
|
|
||||||
<View style={styles.trackingControls}>
|
|
||||||
<View style={styles.progress}>
|
|
||||||
<View style={[styles.innerProgressCompleted, {flex: flexCompleted}]} />
|
|
||||||
<View style={[styles.innerProgressRemaining, {flex: flexRemaining}]} />
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
renderNativeSkin() {
|
|
||||||
const videoStyle = this.state.skin == 'embed' ? styles.nativeVideoControls : styles.fullScreen;
|
|
||||||
return (
|
|
||||||
<View style={styles.container}>
|
|
||||||
<View style={styles.fullScreen}>
|
|
||||||
<Video
|
|
||||||
source={require('./broadchurch.mp4')}
|
|
||||||
style={videoStyle}
|
|
||||||
rate={this.state.rate}
|
|
||||||
paused={this.state.paused}
|
|
||||||
volume={this.state.volume}
|
|
||||||
muted={this.state.muted}
|
|
||||||
ignoreSilentSwitch={this.state.ignoreSilentSwitch}
|
|
||||||
mixWithOthers={this.state.mixWithOthers}
|
|
||||||
resizeMode={this.state.resizeMode}
|
|
||||||
onLoad={this.onLoad}
|
|
||||||
onBuffer={this.onBuffer}
|
|
||||||
onProgress={this.onProgress}
|
|
||||||
onEnd={() => { Alert.alert('Done!') }}
|
|
||||||
repeat={true}
|
|
||||||
controls={this.state.controls}
|
|
||||||
filter={this.state.filter}
|
|
||||||
filterEnabled={this.state.filterEnabled}
|
|
||||||
adTagUrl={adTagUrl}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
<View style={styles.controls}>
|
|
||||||
<View style={styles.generalControls}>
|
|
||||||
<View style={styles.skinControl}>
|
|
||||||
{this.renderSkinControl('custom')}
|
|
||||||
{this.renderSkinControl('native')}
|
|
||||||
{this.renderSkinControl('embed')}
|
|
||||||
</View>
|
|
||||||
{
|
|
||||||
(this.state.filterEnabled) ?
|
|
||||||
<View style={styles.skinControl}>
|
|
||||||
<TouchableOpacity onPress={() => {
|
|
||||||
this.setFilter(-1)
|
|
||||||
}}>
|
|
||||||
<Text style={styles.controlOption}>Previous Filter</Text>
|
|
||||||
</TouchableOpacity>
|
|
||||||
<TouchableOpacity onPress={() => {
|
|
||||||
this.setFilter(1)
|
|
||||||
}}>
|
|
||||||
<Text style={styles.controlOption}>Next Filter</Text>
|
|
||||||
</TouchableOpacity>
|
|
||||||
</View> : null
|
|
||||||
}
|
|
||||||
</View>
|
|
||||||
<View style={styles.generalControls}>
|
|
||||||
<View style={styles.rateControl}>
|
|
||||||
{this.renderRateControl(0.5)}
|
|
||||||
{this.renderRateControl(1.0)}
|
|
||||||
{this.renderRateControl(2.0)}
|
|
||||||
</View>
|
|
||||||
|
|
||||||
<View style={styles.volumeControl}>
|
|
||||||
{this.renderVolumeControl(0.5)}
|
|
||||||
{this.renderVolumeControl(1)}
|
|
||||||
{this.renderVolumeControl(1.5)}
|
|
||||||
</View>
|
|
||||||
|
|
||||||
<View style={styles.resizeModeControl}>
|
|
||||||
{this.renderResizeModeControl('cover')}
|
|
||||||
{this.renderResizeModeControl('contain')}
|
|
||||||
{this.renderResizeModeControl('stretch')}
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
<View style={styles.generalControls}>
|
|
||||||
{
|
|
||||||
(Platform.OS === 'ios') ?
|
|
||||||
<>
|
|
||||||
<View style={styles.ignoreSilentSwitchControl}>
|
|
||||||
{this.renderIgnoreSilentSwitchControl('ignore')}
|
|
||||||
{this.renderIgnoreSilentSwitchControl('obey')}
|
|
||||||
</View>
|
|
||||||
<View style={styles.mixWithOthersControl}>
|
|
||||||
{this.renderMixWithOthersControl('mix')}
|
|
||||||
{this.renderMixWithOthersControl('duck')}
|
|
||||||
</View>
|
|
||||||
</> : null
|
|
||||||
}
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
|
||||||
return this.state.controls ? this.renderNativeSkin() : this.renderCustomSkin();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
|
||||||
container: {
|
|
||||||
flex: 1,
|
|
||||||
justifyContent: 'center',
|
|
||||||
alignItems: 'center',
|
|
||||||
backgroundColor: 'black',
|
|
||||||
},
|
|
||||||
fullScreen: {
|
|
||||||
position: 'absolute',
|
|
||||||
top: 0,
|
|
||||||
left: 0,
|
|
||||||
bottom: 0,
|
|
||||||
right: 0,
|
|
||||||
},
|
|
||||||
controls: {
|
|
||||||
backgroundColor: "transparent",
|
|
||||||
borderRadius: 5,
|
|
||||||
position: 'absolute',
|
|
||||||
bottom: 44,
|
|
||||||
left: 4,
|
|
||||||
right: 4,
|
|
||||||
},
|
|
||||||
progress: {
|
|
||||||
flex: 1,
|
|
||||||
flexDirection: 'row',
|
|
||||||
borderRadius: 3,
|
|
||||||
overflow: 'hidden',
|
|
||||||
},
|
|
||||||
innerProgressCompleted: {
|
|
||||||
height: 20,
|
|
||||||
backgroundColor: '#cccccc',
|
|
||||||
},
|
|
||||||
innerProgressRemaining: {
|
|
||||||
height: 20,
|
|
||||||
backgroundColor: '#2C2C2C',
|
|
||||||
},
|
|
||||||
generalControls: {
|
|
||||||
flex: 1,
|
|
||||||
flexDirection: 'row',
|
|
||||||
overflow: 'hidden',
|
|
||||||
paddingBottom: 10,
|
|
||||||
},
|
|
||||||
skinControl: {
|
|
||||||
flex: 1,
|
|
||||||
flexDirection: 'row',
|
|
||||||
justifyContent: 'center',
|
|
||||||
},
|
|
||||||
rateControl: {
|
|
||||||
flex: 1,
|
|
||||||
flexDirection: 'row',
|
|
||||||
justifyContent: 'center',
|
|
||||||
},
|
|
||||||
volumeControl: {
|
|
||||||
flex: 1,
|
|
||||||
flexDirection: 'row',
|
|
||||||
justifyContent: 'center',
|
|
||||||
},
|
|
||||||
resizeModeControl: {
|
|
||||||
flex: 1,
|
|
||||||
flexDirection: 'row',
|
|
||||||
alignItems: 'center',
|
|
||||||
justifyContent: 'center'
|
|
||||||
},
|
|
||||||
ignoreSilentSwitchControl: {
|
|
||||||
flex: 1,
|
|
||||||
flexDirection: 'row',
|
|
||||||
alignItems: 'center',
|
|
||||||
justifyContent: 'center'
|
|
||||||
},
|
|
||||||
mixWithOthersControl: {
|
|
||||||
flex: 1,
|
|
||||||
flexDirection: 'row',
|
|
||||||
alignItems: 'center',
|
|
||||||
justifyContent: 'center'
|
|
||||||
},
|
|
||||||
controlOption: {
|
|
||||||
alignSelf: 'center',
|
|
||||||
fontSize: 11,
|
|
||||||
color: "white",
|
|
||||||
paddingLeft: 2,
|
|
||||||
paddingRight: 2,
|
|
||||||
lineHeight: 12,
|
|
||||||
},
|
|
||||||
nativeVideoControls: {
|
|
||||||
top: 184,
|
|
||||||
height: 300
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
AppRegistry.registerComponent('VideoPlayer', () => VideoPlayer);
|
|
@ -319,7 +319,6 @@
|
|||||||
developmentRegion = en;
|
developmentRegion = en;
|
||||||
hasScannedForEncodings = 0;
|
hasScannedForEncodings = 0;
|
||||||
knownRegions = (
|
knownRegions = (
|
||||||
English,
|
|
||||||
en,
|
en,
|
||||||
Base,
|
Base,
|
||||||
);
|
);
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
const fs = require('fs');
|
|
||||||
const path = require('path');
|
|
||||||
module.exports = {
|
|
||||||
reactNativePath: fs.realpathSync(path.resolve(require.resolve('react-native-windows/package.json'), '..')),
|
|
||||||
dependencies: {
|
|
||||||
'react-native-video-inc-ads': {
|
|
||||||
platforms: {
|
|
||||||
android: {
|
|
||||||
sourceDir:
|
|
||||||
'../node_modules/react-native-video-inc-ads/android-exoplayer',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
Loading…
Reference in New Issue
Block a user