Since exo add API changed removed the ads media source implementation.

This commit is contained in:
Olgun Kaya 2021-08-01 14:47:11 +03:00
parent 112310c38d
commit 7a1bc64c08
4 changed files with 15 additions and 18 deletions

View File

@ -92,8 +92,7 @@ class ReactExoplayerView extends FrameLayout implements
BecomingNoisyListener,
AudioManager.OnAudioFocusChangeListener,
MetadataOutput,
DefaultDrmSessionEventListener,
AdsMediaSource.MediaSourceFactory {
DefaultDrmSessionEventListener {
private static final String TAG = "ReactExoplayerView";
@ -446,7 +445,7 @@ class ReactExoplayerView extends FrameLayout implements
player = ExoPlayerFactory.newSimpleInstance(getContext(), renderersFactory,
trackSelector, defaultLoadControl, drmSessionManager, bandwidthMeter);
player.addListener(self);
player.addMetadataOutput(self);
player.addMetadataOutput(self); //a random comment here
adsLoader.setPlayer(player);
exoPlayerView.setPlayer(player);
audioBecomingNoisyReceiver.setListener(self);
@ -508,18 +507,6 @@ class ReactExoplayerView extends FrameLayout implements
}
return new DefaultDrmSessionManager<>(uuid,
FrameworkMediaDrm.newInstance(uuid), drmCallback, null, false, 3);
// AdsMediaSource.MediaSourceFactory implementation.
}
@Override
public MediaSource createMediaSource(Uri uri) {
return buildMediaSource(uri, extension);
}
@Override
public int[] getSupportedTypes() {
// IMA does not support Smooth Streaming ads.
return new int[] {C.TYPE_DASH, C.TYPE_HLS, C.TYPE_OTHER};
}
private MediaSource buildMediaSource(Uri uri, String overrideExtension) {

View File

@ -135,7 +135,7 @@ android {
}
dependencies {
implementation project(':react-native-video')
implementation project(':react-native-video-inc-ads')
implementation "com.facebook.react:react-native:+" // From node_modules
implementation 'org.webkit:android-jsc:+'
}

View File

@ -1,6 +1,6 @@
rootProject.name = 'VideoPlayer'
include ':react-native-video'
project(':react-native-video').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-video/android-exoplayer')
include ':react-native-video-inc-ads'
project(':react-native-video-inc-ads').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-video-inc-ads/android-exoplayer')
include ':app'

View File

@ -2,4 +2,14 @@ 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',
},
},
},
},
};