fix: add stub for IMA and option to enable it on demand
This commit is contained in:
parent
0e0ff18b27
commit
57b4a76775
@ -4,6 +4,18 @@ def safeExtGet(prop, fallback) {
|
|||||||
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def useExoplayerIMA = safeExtGet("RNVUseExoplayerIMA", false)
|
||||||
|
|
||||||
|
println "useExoplayerIMA:" + useExoplayerIMA
|
||||||
|
|
||||||
|
// This string is used to define build path.
|
||||||
|
// As react native build output directory is react-native path of the module.
|
||||||
|
// We need to force a new path on each configuration change.
|
||||||
|
// If you add a new build parameter, please add the new value in this string
|
||||||
|
def configStringPath = (
|
||||||
|
'useExoplayerIMA' + useExoplayerIMA \
|
||||||
|
).md5()
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion safeExtGet('compileSdkVersion', 31)
|
compileSdkVersion safeExtGet('compileSdkVersion', 31)
|
||||||
buildToolsVersion safeExtGet('buildToolsVersion', '30.0.2')
|
buildToolsVersion safeExtGet('buildToolsVersion', '30.0.2')
|
||||||
@ -24,6 +36,19 @@ android {
|
|||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
targetCompatibility JavaVersion.VERSION_1_8
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buildDir 'buildOutput_' + configStringPath
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
main {
|
||||||
|
java {
|
||||||
|
if (useExoplayerIMA) {
|
||||||
|
exclude 'com/google/ads/interactivemedia/v3/api'
|
||||||
|
exclude 'com/android/exoplayer2/ext/ima'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
@ -45,7 +70,9 @@ dependencies {
|
|||||||
implementation('com.google.android.exoplayer:extension-okhttp:2.18.1') {
|
implementation('com.google.android.exoplayer:extension-okhttp:2.18.1') {
|
||||||
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
|
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
|
||||||
}
|
}
|
||||||
implementation 'com.google.android.exoplayer:extension-ima:2.18.1'
|
|
||||||
|
|
||||||
|
if (useExoplayerIMA) {
|
||||||
|
implementation 'com.google.android.exoplayer:extension-ima:2.18.1'
|
||||||
|
}
|
||||||
implementation "com.squareup.okhttp3:okhttp:" + '$OKHTTP_VERSION'
|
implementation "com.squareup.okhttp3:okhttp:" + '$OKHTTP_VERSION'
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.google.ads.interactivemedia.v3.api;
|
||||||
|
|
||||||
|
import androidx.annotation.InspectableProperty;
|
||||||
|
|
||||||
|
public abstract class AdEvent {
|
||||||
|
public abstract InspectableProperty getType();
|
||||||
|
|
||||||
|
public interface AdEventListener {
|
||||||
|
public void onAdEvent(AdEvent adEvent);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,65 @@
|
|||||||
|
package com.google.android.exoplayer2.ext.ima;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.facebook.react.uimanager.ThemedReactContext;
|
||||||
|
import com.google.android.exoplayer2.ExoPlayer;
|
||||||
|
import com.google.android.exoplayer2.Player;
|
||||||
|
import com.google.android.exoplayer2.source.ads.AdsLoader;
|
||||||
|
import com.google.android.exoplayer2.source.ads.AdsMediaSource;
|
||||||
|
import com.google.android.exoplayer2.ui.AdViewProvider;
|
||||||
|
import com.google.android.exoplayer2.upstream.DataSpec;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class ImaAdsLoader implements AdsLoader {
|
||||||
|
public void setPlayer(ExoPlayer player) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPlayer(@Nullable Player player) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void release() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSupportedContentTypes(int... ints) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start(AdsMediaSource adsMediaSource, DataSpec dataSpec, Object o, AdViewProvider adViewProvider, EventListener eventListener) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stop(AdsMediaSource adsMediaSource, EventListener eventListener) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handlePrepareComplete(AdsMediaSource adsMediaSource, int i, int i1) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handlePrepareError(AdsMediaSource adsMediaSource, int i, int i1, IOException e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
public Builder(ThemedReactContext themedReactContext) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setAdEventListener(Object reactExoplayerView) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImaAdsLoader build() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -14,6 +14,8 @@ buildscript {
|
|||||||
// Otherwise we default to the side-by-side NDK version from AGP.
|
// Otherwise we default to the side-by-side NDK version from AGP.
|
||||||
ndkVersion = "21.4.7075529"
|
ndkVersion = "21.4.7075529"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RNVUseExoplayerIMA = true
|
||||||
}
|
}
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
|
Loading…
Reference in New Issue
Block a user