ExoPlayer (#426)

This commit is contained in:
Andrew Jack
2017-01-11 12:51:45 +00:00
committed by Matt Apperson
parent cd53e389a0
commit 9a936c9e8f
32 changed files with 1744 additions and 71 deletions

View File

@@ -131,6 +131,24 @@ export default class Video extends Component {
}
};
_onAudioBecomingNoisy = () => {
if (this.props.onAudioBecomingNoisy) {
this.props.onAudioBecomingNoisy();
}
};
_onAudioFocusChanged = (event) => {
if (this.props.onAudioFocusChanged) {
this.props.onAudioFocusChanged(event.nativeEvent);
}
};
_onBuffer = (event) => {
if (this.props.onBuffer) {
this.props.onBuffer(event.nativeEvent);
}
};
render() {
const resizeMode = this.props.resizeMode;
const source = resolveAssetSource(this.props.source) || {};
@@ -162,7 +180,7 @@ export default class Video extends Component {
uri,
isNetwork,
isAsset,
type: source.type || 'mp4',
type: source.type,
mainVer: source.mainVer || 0,
patchVer: source.patchVer || 0,
},
@@ -172,6 +190,7 @@ export default class Video extends Component {
onVideoProgress: this._onProgress,
onVideoSeek: this._onSeek,
onVideoEnd: this._onEnd,
onVideoBuffer: this._onBuffer,
onVideoFullscreenPlayerWillPresent: this._onFullscreenPlayerWillPresent,
onVideoFullscreenPlayerDidPresent: this._onFullscreenPlayerDidPresent,
onVideoFullscreenPlayerWillDismiss: this._onFullscreenPlayerWillDismiss,
@@ -180,6 +199,8 @@ export default class Video extends Component {
onPlaybackStalled: this._onPlaybackStalled,
onPlaybackResume: this._onPlaybackResume,
onPlaybackRateChange: this._onPlaybackRateChange,
onAudioFocusChanged: this._onAudioFocusChanged,
onAudioBecomingNoisy: this._onAudioBecomingNoisy,
});
if (this.props.poster && this.state.showPoster) {
@@ -222,6 +243,7 @@ Video.propTypes = {
fullscreen: PropTypes.bool,
onVideoLoadStart: PropTypes.func,
onVideoLoad: PropTypes.func,
onVideoBuffer: PropTypes.func,
onVideoError: PropTypes.func,
onVideoProgress: PropTypes.func,
onVideoSeek: PropTypes.func,
@@ -248,11 +270,13 @@ Video.propTypes = {
rate: PropTypes.number,
playInBackground: PropTypes.bool,
playWhenInactive: PropTypes.bool,
disableFocus: PropTypes.bool,
controls: PropTypes.bool,
currentTime: PropTypes.number,
progressUpdateInterval: PropTypes.number,
onLoadStart: PropTypes.func,
onLoad: PropTypes.func,
onBuffer: PropTypes.func,
onError: PropTypes.func,
onProgress: PropTypes.func,
onSeek: PropTypes.func,
@@ -265,6 +289,8 @@ Video.propTypes = {
onPlaybackStalled: PropTypes.func,
onPlaybackResume: PropTypes.func,
onPlaybackRateChange: PropTypes.func,
onAudioFocusChanged: PropTypes.func,
onAudioBecomingNoisy: PropTypes.func,
/* Required by react-native */
scaleX: PropTypes.number,