feat(android): allow to disable selected functionalities (#3681)
* feat(android): add possibility do disable some of functionalities * create dump classes * remove dump files when functionalities are enabled * add docs * enable all functionalities in example * throw error when trying to use disabled functionality * update docs
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package androidx.media3.exoplayer.dash;
|
||||
|
||||
import androidx.media3.common.MediaItem;
|
||||
import androidx.media3.datasource.DataSource;
|
||||
import androidx.media3.exoplayer.drm.DrmSessionManagerProvider;
|
||||
import androidx.media3.exoplayer.source.MediaSource;
|
||||
import androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy;
|
||||
|
||||
public class DashMediaSource {
|
||||
public static class Factory implements MediaSource.Factory {
|
||||
|
||||
public Factory(DefaultDashChunkSource.Factory factory, DataSource.Factory factory1) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MediaSource.Factory setDrmSessionManagerProvider(DrmSessionManagerProvider drmSessionManagerProvider) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MediaSource.Factory setLoadErrorHandlingPolicy(LoadErrorHandlingPolicy loadErrorHandlingPolicy) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSupportedTypes() {
|
||||
return new int[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public MediaSource createMediaSource(MediaItem mediaItem) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,12 @@
|
||||
package androidx.media3.exoplayer.dash;
|
||||
|
||||
import android.net.Uri;
|
||||
|
||||
import androidx.media3.datasource.DataSource;
|
||||
import androidx.media3.exoplayer.dash.manifest.DashManifest;
|
||||
|
||||
public class DashUtil {
|
||||
public static DashManifest loadManifest(DataSource ds, Uri uri) {
|
||||
return null;
|
||||
}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
package androidx.media3.exoplayer.dash;
|
||||
|
||||
import androidx.media3.datasource.DataSource;
|
||||
|
||||
public class DefaultDashChunkSource {
|
||||
public static final class Factory {
|
||||
public Factory(DataSource.Factory mediaDataSourceFactory) {
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
package androidx.media3.exoplayer.dash.manifest;
|
||||
|
||||
import androidx.collection.CircularArray;
|
||||
import androidx.media3.common.C;
|
||||
|
||||
public class AdaptationSet {
|
||||
public int type = 0;
|
||||
public CircularArray<Representation> representations;
|
||||
|
||||
public AdaptationSet() {
|
||||
representations = null;
|
||||
}
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
package androidx.media3.exoplayer.dash.manifest;
|
||||
|
||||
public class DashManifest {
|
||||
public DashManifest() {
|
||||
|
||||
}
|
||||
|
||||
public int getPeriodCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Period getPeriod(int index) {
|
||||
return null;
|
||||
}
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
package androidx.media3.exoplayer.dash.manifest;
|
||||
|
||||
import androidx.collection.CircularArray;
|
||||
|
||||
public class Period {
|
||||
public CircularArray<AdaptationSet> adaptationSets;
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
package androidx.media3.exoplayer.dash.manifest;
|
||||
|
||||
import androidx.media3.common.Format;
|
||||
|
||||
public class Representation {
|
||||
public Format format;
|
||||
public long presentationTimeOffsetUs;
|
||||
|
||||
public Representation() {
|
||||
format = null;
|
||||
}
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
package androidx.media3.exoplayer.hls;
|
||||
|
||||
import androidx.media3.common.MediaItem;
|
||||
import androidx.media3.datasource.DataSource;
|
||||
import androidx.media3.exoplayer.drm.DrmSessionManagerProvider;
|
||||
import androidx.media3.exoplayer.source.MediaSource;
|
||||
import androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy;
|
||||
|
||||
public class HlsMediaSource {
|
||||
public static class Factory implements MediaSource.Factory {
|
||||
public Factory(DataSource.Factory mediaDataSourceFactory) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MediaSource.Factory setDrmSessionManagerProvider(DrmSessionManagerProvider drmSessionManagerProvider) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MediaSource.Factory setLoadErrorHandlingPolicy(LoadErrorHandlingPolicy loadErrorHandlingPolicy) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSupportedTypes() {
|
||||
return new int[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public MediaSource createMediaSource(MediaItem mediaItem) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
package androidx.media3.exoplayer.rtsp;
|
||||
|
||||
import androidx.media3.common.MediaItem;
|
||||
import androidx.media3.exoplayer.drm.DrmSessionManagerProvider;
|
||||
import androidx.media3.exoplayer.source.MediaSource;
|
||||
import androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy;
|
||||
|
||||
public class RtspMediaSource {
|
||||
public RtspMediaSource() {
|
||||
|
||||
}
|
||||
|
||||
public static class Factory implements MediaSource.Factory {
|
||||
@Override
|
||||
public MediaSource.Factory setDrmSessionManagerProvider(DrmSessionManagerProvider drmSessionManagerProvider) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MediaSource.Factory setLoadErrorHandlingPolicy(LoadErrorHandlingPolicy loadErrorHandlingPolicy) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSupportedTypes() {
|
||||
return new int[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public MediaSource createMediaSource(MediaItem mediaItem) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
package androidx.media3.exoplayer.smoothstreaming;
|
||||
|
||||
import androidx.media3.common.MediaItem;
|
||||
import androidx.media3.datasource.DataSource;
|
||||
import androidx.media3.exoplayer.drm.DrmSessionManagerProvider;
|
||||
import androidx.media3.exoplayer.source.MediaSource;
|
||||
import androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy;
|
||||
|
||||
public class DefaultSsChunkSource {
|
||||
public static class Factory implements MediaSource.Factory {
|
||||
public Factory(DataSource.Factory mediaDataSourceFactory) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MediaSource.Factory setDrmSessionManagerProvider(DrmSessionManagerProvider drmSessionManagerProvider) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MediaSource.Factory setLoadErrorHandlingPolicy(LoadErrorHandlingPolicy loadErrorHandlingPolicy) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSupportedTypes() {
|
||||
return new int[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public MediaSource createMediaSource(MediaItem mediaItem) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
package androidx.media3.exoplayer.smoothstreaming;
|
||||
|
||||
import androidx.media3.common.MediaItem;
|
||||
import androidx.media3.datasource.DataSource;
|
||||
import androidx.media3.exoplayer.drm.DrmSessionManagerProvider;
|
||||
import androidx.media3.exoplayer.source.MediaSource;
|
||||
import androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy;
|
||||
|
||||
public class SsMediaSource {
|
||||
public static class Factory implements MediaSource.Factory {
|
||||
public Factory(DefaultSsChunkSource.Factory factory, DataSource.Factory factory1) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MediaSource.Factory setDrmSessionManagerProvider(DrmSessionManagerProvider drmSessionManagerProvider) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MediaSource.Factory setLoadErrorHandlingPolicy(LoadErrorHandlingPolicy loadErrorHandlingPolicy) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSupportedTypes() {
|
||||
return new int[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public MediaSource createMediaSource(MediaItem mediaItem) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@@ -101,6 +101,7 @@ import com.brentvatne.common.api.Track;
|
||||
import com.brentvatne.common.api.VideoTrack;
|
||||
import com.brentvatne.common.react.VideoEventEmitter;
|
||||
import com.brentvatne.common.toolbox.DebugLog;
|
||||
import com.brentvatne.react.BuildConfig;
|
||||
import com.brentvatne.react.R;
|
||||
import com.brentvatne.receiver.AudioBecomingNoisyReceiver;
|
||||
import com.brentvatne.receiver.BecomingNoisyListener;
|
||||
@@ -822,18 +823,33 @@ public class ReactExoplayerView extends FrameLayout implements
|
||||
|
||||
switch (type) {
|
||||
case CONTENT_TYPE_SS:
|
||||
if(!BuildConfig.USE_EXOPLAYER_SMOOTH_STREAMING) {
|
||||
DebugLog.e("Exo Player Exception", "Smooth Streaming is not enabled!");
|
||||
throw new IllegalStateException("Smooth Streaming is not enabled!");
|
||||
}
|
||||
|
||||
mediaSourceFactory = new SsMediaSource.Factory(
|
||||
new DefaultSsChunkSource.Factory(mediaDataSourceFactory),
|
||||
buildDataSourceFactory(false)
|
||||
);
|
||||
break;
|
||||
case CONTENT_TYPE_DASH:
|
||||
if(!BuildConfig.USE_EXOPLAYER_DASH) {
|
||||
DebugLog.e("Exo Player Exception", "DASH is not enabled!");
|
||||
throw new IllegalStateException("DASH is not enabled!");
|
||||
}
|
||||
|
||||
mediaSourceFactory = new DashMediaSource.Factory(
|
||||
new DefaultDashChunkSource.Factory(mediaDataSourceFactory),
|
||||
buildDataSourceFactory(false)
|
||||
);
|
||||
break;
|
||||
case CONTENT_TYPE_HLS:
|
||||
if (!BuildConfig.USE_EXOPLAYER_HLS) {
|
||||
DebugLog.e("Exo Player Exception", "HLS is not enabled!");
|
||||
throw new IllegalStateException("HLS is not enabled!");
|
||||
}
|
||||
|
||||
mediaSourceFactory = new HlsMediaSource.Factory(
|
||||
mediaDataSourceFactory
|
||||
);
|
||||
@@ -844,6 +860,11 @@ public class ReactExoplayerView extends FrameLayout implements
|
||||
);
|
||||
break;
|
||||
case CONTENT_TYPE_RTSP:
|
||||
if (!BuildConfig.USE_EXOPLAYER_RTSP) {
|
||||
DebugLog.e("Exo Player Exception", "RTSP is not enabled!");
|
||||
throw new IllegalStateException("RTSP is not enabled!");
|
||||
}
|
||||
|
||||
mediaSourceFactory = new RtspMediaSource.Factory();
|
||||
break;
|
||||
default: {
|
||||
|
Reference in New Issue
Block a user