Migrate usages from C.TYPE_* to C.CONTENT_TYPE_*
PiperOrigin-RevId: 446156308
This commit is contained in:
parent
b410a922fe
commit
9a67b30750
@ -163,12 +163,12 @@ public final class MainActivity extends Activity {
|
||||
TextUtils.isEmpty(fileExtension)
|
||||
? Util.inferContentType(uri)
|
||||
: Util.inferContentTypeForExtension(fileExtension);
|
||||
if (type == C.TYPE_DASH) {
|
||||
if (type == C.CONTENT_TYPE_DASH) {
|
||||
mediaSource =
|
||||
new DashMediaSource.Factory(dataSourceFactory)
|
||||
.setDrmSessionManagerProvider(unusedMediaItem -> drmSessionManager)
|
||||
.createMediaSource(MediaItem.fromUri(uri));
|
||||
} else if (type == C.TYPE_OTHER) {
|
||||
} else if (type == C.CONTENT_TYPE_OTHER) {
|
||||
mediaSource =
|
||||
new ProgressiveMediaSource.Factory(dataSourceFactory)
|
||||
.setDrmSessionManagerProvider(unusedMediaItem -> drmSessionManager)
|
||||
|
@ -208,12 +208,12 @@ public final class MainActivity extends Activity {
|
||||
TextUtils.isEmpty(fileExtension)
|
||||
? Util.inferContentType(uri)
|
||||
: Util.inferContentTypeForExtension(fileExtension);
|
||||
if (type == C.TYPE_DASH) {
|
||||
if (type == C.CONTENT_TYPE_DASH) {
|
||||
mediaSource =
|
||||
new DashMediaSource.Factory(dataSourceFactory)
|
||||
.setDrmSessionManagerProvider(unusedMediaItem -> drmSessionManager)
|
||||
.createMediaSource(MediaItem.fromUri(uri));
|
||||
} else if (type == C.TYPE_OTHER) {
|
||||
} else if (type == C.CONTENT_TYPE_OTHER) {
|
||||
mediaSource =
|
||||
new ProgressiveMediaSource.Factory(dataSourceFactory)
|
||||
.setDrmSessionManagerProvider(unusedMediaItem -> drmSessionManager)
|
||||
|
@ -1924,18 +1924,18 @@ public final class Util {
|
||||
public static @ContentType int inferContentType(Uri uri) {
|
||||
@Nullable String scheme = uri.getScheme();
|
||||
if (scheme != null && Ascii.equalsIgnoreCase("rtsp", scheme)) {
|
||||
return C.TYPE_RTSP;
|
||||
return C.CONTENT_TYPE_RTSP;
|
||||
}
|
||||
|
||||
@Nullable String lastPathSegment = uri.getLastPathSegment();
|
||||
if (lastPathSegment == null) {
|
||||
return C.TYPE_OTHER;
|
||||
return C.CONTENT_TYPE_OTHER;
|
||||
}
|
||||
int lastDotIndex = lastPathSegment.lastIndexOf('.');
|
||||
if (lastDotIndex >= 0) {
|
||||
@C.ContentType
|
||||
int contentType = inferContentTypeForExtension(lastPathSegment.substring(lastDotIndex + 1));
|
||||
if (contentType != C.TYPE_OTHER) {
|
||||
if (contentType != C.CONTENT_TYPE_OTHER) {
|
||||
// If contentType is TYPE_SS that indicates the extension is .ism or .isml and shows the ISM
|
||||
// URI is missing the "/manifest" suffix, which contains the information used to
|
||||
// disambiguate between Smooth Streaming, HLS and DASH below - so we can just return TYPE_SS
|
||||
@ -1949,15 +1949,15 @@ public final class Util {
|
||||
@Nullable String extensions = ismMatcher.group(2);
|
||||
if (extensions != null) {
|
||||
if (extensions.contains(ISM_DASH_FORMAT_EXTENSION)) {
|
||||
return C.TYPE_DASH;
|
||||
return C.CONTENT_TYPE_DASH;
|
||||
} else if (extensions.contains(ISM_HLS_FORMAT_EXTENSION)) {
|
||||
return C.TYPE_HLS;
|
||||
return C.CONTENT_TYPE_HLS;
|
||||
}
|
||||
}
|
||||
return C.TYPE_SS;
|
||||
return C.CONTENT_TYPE_SS;
|
||||
}
|
||||
|
||||
return C.TYPE_OTHER;
|
||||
return C.CONTENT_TYPE_OTHER;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1980,14 +1980,14 @@ public final class Util {
|
||||
fileExtension = Ascii.toLowerCase(fileExtension);
|
||||
switch (fileExtension) {
|
||||
case "mpd":
|
||||
return C.TYPE_DASH;
|
||||
return C.CONTENT_TYPE_DASH;
|
||||
case "m3u8":
|
||||
return C.TYPE_HLS;
|
||||
return C.CONTENT_TYPE_HLS;
|
||||
case "ism":
|
||||
case "isml":
|
||||
return C.TYPE_SS;
|
||||
default:
|
||||
return C.TYPE_OTHER;
|
||||
return C.CONTENT_TYPE_OTHER;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2005,15 +2005,15 @@ public final class Util {
|
||||
}
|
||||
switch (mimeType) {
|
||||
case MimeTypes.APPLICATION_MPD:
|
||||
return C.TYPE_DASH;
|
||||
return C.CONTENT_TYPE_DASH;
|
||||
case MimeTypes.APPLICATION_M3U8:
|
||||
return C.TYPE_HLS;
|
||||
return C.CONTENT_TYPE_HLS;
|
||||
case MimeTypes.APPLICATION_SS:
|
||||
return C.TYPE_SS;
|
||||
return C.CONTENT_TYPE_SS;
|
||||
case MimeTypes.APPLICATION_RTSP:
|
||||
return C.TYPE_RTSP;
|
||||
return C.CONTENT_TYPE_RTSP;
|
||||
default:
|
||||
return C.TYPE_OTHER;
|
||||
return C.CONTENT_TYPE_OTHER;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2024,14 +2024,14 @@ public final class Util {
|
||||
@Nullable
|
||||
public static String getAdaptiveMimeTypeForContentType(@ContentType int contentType) {
|
||||
switch (contentType) {
|
||||
case C.TYPE_DASH:
|
||||
case C.CONTENT_TYPE_DASH:
|
||||
return MimeTypes.APPLICATION_MPD;
|
||||
case C.TYPE_HLS:
|
||||
case C.CONTENT_TYPE_HLS:
|
||||
return MimeTypes.APPLICATION_M3U8;
|
||||
case C.TYPE_SS:
|
||||
case C.CONTENT_TYPE_SS:
|
||||
return MimeTypes.APPLICATION_SS;
|
||||
case C.TYPE_RTSP:
|
||||
case C.TYPE_OTHER:
|
||||
case C.CONTENT_TYPE_RTSP:
|
||||
case C.CONTENT_TYPE_OTHER:
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
@ -104,65 +104,67 @@ public class UtilTest {
|
||||
@Test
|
||||
public void inferContentType_handlesHlsIsmUris() {
|
||||
assertThat(Util.inferContentType(Uri.parse("http://a.b/c.ism/manifest(format=m3u8-aapl)")))
|
||||
.isEqualTo(C.TYPE_HLS);
|
||||
.isEqualTo(C.CONTENT_TYPE_HLS);
|
||||
assertThat(
|
||||
Util.inferContentType(
|
||||
Uri.parse("http://a.b/c.ism/manifest(format=m3u8-aapl,quality=hd)")))
|
||||
.isEqualTo(C.TYPE_HLS);
|
||||
.isEqualTo(C.CONTENT_TYPE_HLS);
|
||||
assertThat(
|
||||
Util.inferContentType(
|
||||
Uri.parse("http://a.b/c.ism/manifest(quality=hd,format=m3u8-aapl)")))
|
||||
.isEqualTo(C.TYPE_HLS);
|
||||
.isEqualTo(C.CONTENT_TYPE_HLS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void inferContentType_handlesHlsIsmV3Uris() {
|
||||
assertThat(Util.inferContentType(Uri.parse("http://a.b/c.ism/manifest(format=m3u8-aapl-v3)")))
|
||||
.isEqualTo(C.TYPE_HLS);
|
||||
.isEqualTo(C.CONTENT_TYPE_HLS);
|
||||
assertThat(
|
||||
Util.inferContentType(
|
||||
Uri.parse("http://a.b/c.ism/manifest(format=m3u8-aapl-v3,quality=hd)")))
|
||||
.isEqualTo(C.TYPE_HLS);
|
||||
.isEqualTo(C.CONTENT_TYPE_HLS);
|
||||
assertThat(
|
||||
Util.inferContentType(
|
||||
Uri.parse("http://a.b/c.ism/manifest(quality=hd,format=m3u8-aapl-v3)")))
|
||||
.isEqualTo(C.TYPE_HLS);
|
||||
.isEqualTo(C.CONTENT_TYPE_HLS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void inferContentType_handlesDashIsmUris() {
|
||||
assertThat(Util.inferContentType(Uri.parse("http://a.b/c.isml/manifest(format=mpd-time-csf)")))
|
||||
.isEqualTo(C.TYPE_DASH);
|
||||
.isEqualTo(C.CONTENT_TYPE_DASH);
|
||||
assertThat(
|
||||
Util.inferContentType(
|
||||
Uri.parse("http://a.b/c.isml/manifest(format=mpd-time-csf,quality=hd)")))
|
||||
.isEqualTo(C.TYPE_DASH);
|
||||
.isEqualTo(C.CONTENT_TYPE_DASH);
|
||||
assertThat(
|
||||
Util.inferContentType(
|
||||
Uri.parse("http://a.b/c.isml/manifest(quality=hd,format=mpd-time-csf)")))
|
||||
.isEqualTo(C.TYPE_DASH);
|
||||
.isEqualTo(C.CONTENT_TYPE_DASH);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void inferContentType_handlesSmoothStreamingIsmUris() {
|
||||
assertThat(Util.inferContentType(Uri.parse("http://a.b/c.ism"))).isEqualTo(C.TYPE_SS);
|
||||
assertThat(Util.inferContentType(Uri.parse("http://a.b/c.isml"))).isEqualTo(C.TYPE_SS);
|
||||
assertThat(Util.inferContentType(Uri.parse("http://a.b/c.ism/"))).isEqualTo(C.TYPE_SS);
|
||||
assertThat(Util.inferContentType(Uri.parse("http://a.b/c.isml/"))).isEqualTo(C.TYPE_SS);
|
||||
assertThat(Util.inferContentType(Uri.parse("http://a.b/c.ism/Manifest"))).isEqualTo(C.TYPE_SS);
|
||||
assertThat(Util.inferContentType(Uri.parse("http://a.b/c.isml/manifest"))).isEqualTo(C.TYPE_SS);
|
||||
assertThat(Util.inferContentType(Uri.parse("http://a.b/c.ism"))).isEqualTo(C.CONTENT_TYPE_SS);
|
||||
assertThat(Util.inferContentType(Uri.parse("http://a.b/c.isml"))).isEqualTo(C.CONTENT_TYPE_SS);
|
||||
assertThat(Util.inferContentType(Uri.parse("http://a.b/c.ism/"))).isEqualTo(C.CONTENT_TYPE_SS);
|
||||
assertThat(Util.inferContentType(Uri.parse("http://a.b/c.isml/"))).isEqualTo(C.CONTENT_TYPE_SS);
|
||||
assertThat(Util.inferContentType(Uri.parse("http://a.b/c.ism/Manifest")))
|
||||
.isEqualTo(C.CONTENT_TYPE_SS);
|
||||
assertThat(Util.inferContentType(Uri.parse("http://a.b/c.isml/manifest")))
|
||||
.isEqualTo(C.CONTENT_TYPE_SS);
|
||||
assertThat(Util.inferContentType(Uri.parse("http://a.b/c.isml/manifest(filter=x)")))
|
||||
.isEqualTo(C.TYPE_SS);
|
||||
.isEqualTo(C.CONTENT_TYPE_SS);
|
||||
assertThat(Util.inferContentType(Uri.parse("http://a.b/c.isml/manifest_hd")))
|
||||
.isEqualTo(C.TYPE_SS);
|
||||
.isEqualTo(C.CONTENT_TYPE_SS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void inferContentType_handlesOtherIsmUris() {
|
||||
assertThat(Util.inferContentType(Uri.parse("http://a.b/c.ism/video.mp4")))
|
||||
.isEqualTo(C.TYPE_OTHER);
|
||||
.isEqualTo(C.CONTENT_TYPE_OTHER);
|
||||
assertThat(Util.inferContentType(Uri.parse("http://a.b/c.ism/prefix-manifest")))
|
||||
.isEqualTo(C.TYPE_OTHER);
|
||||
.isEqualTo(C.CONTENT_TYPE_OTHER);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -172,11 +174,11 @@ public class UtilTest {
|
||||
@SuppressWarnings("deprecation")
|
||||
@Test
|
||||
public void inferContentType_extensionAsPath() {
|
||||
assertThat(Util.inferContentType(".m3u8")).isEqualTo(C.TYPE_HLS);
|
||||
assertThat(Util.inferContentType(".mpd")).isEqualTo(C.TYPE_DASH);
|
||||
assertThat(Util.inferContentType(".m3u8")).isEqualTo(C.CONTENT_TYPE_HLS);
|
||||
assertThat(Util.inferContentType(".mpd")).isEqualTo(C.CONTENT_TYPE_DASH);
|
||||
assertThat(Util.inferContentType(".ism")).isEqualTo(C.TYPE_SS);
|
||||
assertThat(Util.inferContentType(".isml")).isEqualTo(C.TYPE_SS);
|
||||
assertThat(Util.inferContentType(".mp4")).isEqualTo(C.TYPE_OTHER);
|
||||
assertThat(Util.inferContentType(".mp4")).isEqualTo(C.CONTENT_TYPE_OTHER);
|
||||
}
|
||||
|
||||
// Testing deprecated method.
|
||||
@ -186,24 +188,24 @@ public class UtilTest {
|
||||
assertThat(
|
||||
Util.inferContentType(
|
||||
Uri.parse("file:///path/to/something.mpd"), /* overrideExtension= */ null))
|
||||
.isEqualTo(C.TYPE_DASH);
|
||||
.isEqualTo(C.CONTENT_TYPE_DASH);
|
||||
assertThat(
|
||||
Util.inferContentType(
|
||||
Uri.parse("file:///path/to/something.mpd"), /* overrideExtension= */ ""))
|
||||
.isEqualTo(C.TYPE_DASH);
|
||||
.isEqualTo(C.CONTENT_TYPE_DASH);
|
||||
assertThat(
|
||||
Util.inferContentType(
|
||||
Uri.parse("file:///path/to/something.mpd"), /* overrideExtension= */ "m3u8"))
|
||||
.isEqualTo(C.TYPE_HLS);
|
||||
.isEqualTo(C.CONTENT_TYPE_HLS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void inferContentTypeForExtension() {
|
||||
assertThat(Util.inferContentTypeForExtension("m3u8")).isEqualTo(C.TYPE_HLS);
|
||||
assertThat(Util.inferContentTypeForExtension("mpd")).isEqualTo(C.TYPE_DASH);
|
||||
assertThat(Util.inferContentTypeForExtension("m3u8")).isEqualTo(C.CONTENT_TYPE_HLS);
|
||||
assertThat(Util.inferContentTypeForExtension("mpd")).isEqualTo(C.CONTENT_TYPE_DASH);
|
||||
assertThat(Util.inferContentTypeForExtension("ism")).isEqualTo(C.TYPE_SS);
|
||||
assertThat(Util.inferContentTypeForExtension("isml")).isEqualTo(C.TYPE_SS);
|
||||
assertThat(Util.inferContentTypeForExtension("mp4")).isEqualTo(C.TYPE_OTHER);
|
||||
assertThat(Util.inferContentTypeForExtension("mp4")).isEqualTo(C.CONTENT_TYPE_OTHER);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -679,13 +679,13 @@ public final class MediaMetricsListener
|
||||
Util.inferContentTypeForUriAndMimeType(
|
||||
mediaItem.localConfiguration.uri, mediaItem.localConfiguration.mimeType);
|
||||
switch (contentType) {
|
||||
case C.TYPE_HLS:
|
||||
case C.CONTENT_TYPE_HLS:
|
||||
return PlaybackMetrics.STREAM_TYPE_HLS;
|
||||
case C.TYPE_DASH:
|
||||
case C.CONTENT_TYPE_DASH:
|
||||
return PlaybackMetrics.STREAM_TYPE_DASH;
|
||||
case C.TYPE_SS:
|
||||
case C.CONTENT_TYPE_SS:
|
||||
return PlaybackMetrics.STREAM_TYPE_SS;
|
||||
case C.TYPE_RTSP:
|
||||
case C.CONTENT_TYPE_RTSP:
|
||||
default:
|
||||
return PlaybackMetrics.STREAM_TYPE_OTHER;
|
||||
}
|
||||
|
@ -73,11 +73,11 @@ public class DefaultDownloaderFactory implements DownloaderFactory {
|
||||
@C.ContentType
|
||||
int contentType = Util.inferContentTypeForUriAndMimeType(request.uri, request.mimeType);
|
||||
switch (contentType) {
|
||||
case C.TYPE_DASH:
|
||||
case C.TYPE_HLS:
|
||||
case C.TYPE_SS:
|
||||
case C.CONTENT_TYPE_DASH:
|
||||
case C.CONTENT_TYPE_HLS:
|
||||
case C.CONTENT_TYPE_SS:
|
||||
return createDownloader(request, contentType);
|
||||
case C.TYPE_OTHER:
|
||||
case C.CONTENT_TYPE_OTHER:
|
||||
return new ProgressiveDownloader(
|
||||
new MediaItem.Builder()
|
||||
.setUri(request.uri)
|
||||
@ -113,7 +113,7 @@ public class DefaultDownloaderFactory implements DownloaderFactory {
|
||||
SparseArray<Constructor<? extends Downloader>> array = new SparseArray<>();
|
||||
try {
|
||||
array.put(
|
||||
C.TYPE_DASH,
|
||||
C.CONTENT_TYPE_DASH,
|
||||
getDownloaderConstructor(
|
||||
Class.forName("androidx.media3.exoplayer.dash.offline.DashDownloader")));
|
||||
} catch (ClassNotFoundException e) {
|
||||
@ -122,7 +122,7 @@ public class DefaultDownloaderFactory implements DownloaderFactory {
|
||||
|
||||
try {
|
||||
array.put(
|
||||
C.TYPE_HLS,
|
||||
C.CONTENT_TYPE_HLS,
|
||||
getDownloaderConstructor(
|
||||
Class.forName("androidx.media3.exoplayer.hls.offline.HlsDownloader")));
|
||||
} catch (ClassNotFoundException e) {
|
||||
@ -130,7 +130,7 @@ public class DefaultDownloaderFactory implements DownloaderFactory {
|
||||
}
|
||||
try {
|
||||
array.put(
|
||||
C.TYPE_SS,
|
||||
C.CONTENT_TYPE_SS,
|
||||
getDownloaderConstructor(
|
||||
Class.forName("androidx.media3.exoplayer.smoothstreaming.offline.SsDownloader")));
|
||||
} catch (ClassNotFoundException e) {
|
||||
|
@ -960,7 +960,7 @@ public final class DownloadHelper {
|
||||
private static boolean isProgressive(MediaItem.LocalConfiguration localConfiguration) {
|
||||
return Util.inferContentTypeForUriAndMimeType(
|
||||
localConfiguration.uri, localConfiguration.mimeType)
|
||||
== C.TYPE_OTHER;
|
||||
== C.CONTENT_TYPE_OTHER;
|
||||
}
|
||||
|
||||
private static final class MediaPreparer
|
||||
|
@ -138,7 +138,9 @@ public final class DownloadRequest implements Parcelable {
|
||||
@Nullable String customCacheKey,
|
||||
@Nullable byte[] data) {
|
||||
@C.ContentType int contentType = Util.inferContentTypeForUriAndMimeType(uri, mimeType);
|
||||
if (contentType == C.TYPE_DASH || contentType == C.TYPE_HLS || contentType == C.TYPE_SS) {
|
||||
if (contentType == C.CONTENT_TYPE_DASH
|
||||
|| contentType == C.CONTENT_TYPE_HLS
|
||||
|| contentType == C.CONTENT_TYPE_SS) {
|
||||
Assertions.checkArgument(
|
||||
customCacheKey == null, "customCacheKey must be null for type: " + contentType);
|
||||
}
|
||||
|
@ -519,11 +519,11 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory {
|
||||
}
|
||||
|
||||
private void ensureAllSuppliersAreLoaded() {
|
||||
maybeLoadSupplier(C.TYPE_DASH);
|
||||
maybeLoadSupplier(C.TYPE_SS);
|
||||
maybeLoadSupplier(C.TYPE_HLS);
|
||||
maybeLoadSupplier(C.TYPE_RTSP);
|
||||
maybeLoadSupplier(C.TYPE_OTHER);
|
||||
maybeLoadSupplier(C.CONTENT_TYPE_DASH);
|
||||
maybeLoadSupplier(C.CONTENT_TYPE_SS);
|
||||
maybeLoadSupplier(C.CONTENT_TYPE_HLS);
|
||||
maybeLoadSupplier(C.CONTENT_TYPE_RTSP);
|
||||
maybeLoadSupplier(C.CONTENT_TYPE_OTHER);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@ -536,31 +536,31 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory {
|
||||
try {
|
||||
Class<? extends MediaSource.Factory> clazz;
|
||||
switch (contentType) {
|
||||
case C.TYPE_DASH:
|
||||
case C.CONTENT_TYPE_DASH:
|
||||
clazz =
|
||||
Class.forName("androidx.media3.exoplayer.dash.DashMediaSource$Factory")
|
||||
.asSubclass(MediaSource.Factory.class);
|
||||
mediaSourceFactorySupplier = () -> newInstance(clazz, dataSourceFactory);
|
||||
break;
|
||||
case C.TYPE_SS:
|
||||
case C.CONTENT_TYPE_SS:
|
||||
clazz =
|
||||
Class.forName("androidx.media3.exoplayer.smoothstreaming.SsMediaSource$Factory")
|
||||
.asSubclass(MediaSource.Factory.class);
|
||||
mediaSourceFactorySupplier = () -> newInstance(clazz, dataSourceFactory);
|
||||
break;
|
||||
case C.TYPE_HLS:
|
||||
case C.CONTENT_TYPE_HLS:
|
||||
clazz =
|
||||
Class.forName("androidx.media3.exoplayer.hls.HlsMediaSource$Factory")
|
||||
.asSubclass(MediaSource.Factory.class);
|
||||
mediaSourceFactorySupplier = () -> newInstance(clazz, dataSourceFactory);
|
||||
break;
|
||||
case C.TYPE_RTSP:
|
||||
case C.CONTENT_TYPE_RTSP:
|
||||
clazz =
|
||||
Class.forName("androidx.media3.exoplayer.rtsp.RtspMediaSource$Factory")
|
||||
.asSubclass(MediaSource.Factory.class);
|
||||
mediaSourceFactorySupplier = () -> newInstance(clazz);
|
||||
break;
|
||||
case C.TYPE_OTHER:
|
||||
case C.CONTENT_TYPE_OTHER:
|
||||
mediaSourceFactorySupplier =
|
||||
() -> new ProgressiveMediaSource.Factory(dataSourceFactory, extractorsFactory);
|
||||
break;
|
||||
|
@ -198,7 +198,7 @@ public final class ProgressiveMediaSource extends BaseMediaSource
|
||||
|
||||
@Override
|
||||
public int[] getSupportedTypes() {
|
||||
return new int[] {C.TYPE_OTHER};
|
||||
return new int[] {C.CONTENT_TYPE_OTHER};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,8 @@ public interface AdsLoader {
|
||||
* be ignored. Called on the main thread by {@link AdsMediaSource}.
|
||||
*
|
||||
* @param contentTypes The supported content types for ad media. Each element must be one of
|
||||
* {@link C#TYPE_DASH}, {@link C#TYPE_HLS}, {@link C#TYPE_SS} and {@link C#TYPE_OTHER}.
|
||||
* {@link C#CONTENT_TYPE_DASH}, {@link C#CONTENT_TYPE_HLS}, {@link C#CONTENT_TYPE_SS} and
|
||||
* {@link C#CONTENT_TYPE_OTHER}.
|
||||
*/
|
||||
@UnstableApi
|
||||
void setSupportedContentTypes(@C.ContentType int... contentTypes);
|
||||
|
@ -188,7 +188,7 @@ public final class DefaultMediaSourceFactoryTest {
|
||||
new DefaultMediaSourceFactory((Context) ApplicationProvider.getApplicationContext())
|
||||
.getSupportedTypes();
|
||||
|
||||
assertThat(supportedTypes).asList().containsExactly(C.TYPE_OTHER);
|
||||
assertThat(supportedTypes).asList().containsExactly(C.CONTENT_TYPE_OTHER);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -292,7 +292,7 @@ public final class DashMediaSource extends BaseMediaSource {
|
||||
|
||||
@Override
|
||||
public int[] getSupportedTypes() {
|
||||
return new int[] {C.TYPE_DASH};
|
||||
return new int[] {C.CONTENT_TYPE_DASH};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,6 +95,6 @@ public class DefaultMediaSourceFactoryTest {
|
||||
new DefaultMediaSourceFactory((Context) ApplicationProvider.getApplicationContext())
|
||||
.getSupportedTypes();
|
||||
|
||||
assertThat(supportedTypes).asList().containsExactly(C.TYPE_OTHER, C.TYPE_DASH);
|
||||
assertThat(supportedTypes).asList().containsExactly(C.CONTENT_TYPE_OTHER, C.CONTENT_TYPE_DASH);
|
||||
}
|
||||
}
|
||||
|
@ -331,7 +331,7 @@ public final class HlsMediaSource extends BaseMediaSource
|
||||
|
||||
@Override
|
||||
public int[] getSupportedTypes() {
|
||||
return new int[] {C.TYPE_HLS};
|
||||
return new int[] {C.CONTENT_TYPE_HLS};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,6 +95,6 @@ public class DefaultMediaSourceFactoryTest {
|
||||
new DefaultMediaSourceFactory((Context) ApplicationProvider.getApplicationContext())
|
||||
.getSupportedTypes();
|
||||
|
||||
assertThat(supportedTypes).asList().containsExactly(C.TYPE_OTHER, C.TYPE_HLS);
|
||||
assertThat(supportedTypes).asList().containsExactly(C.CONTENT_TYPE_OTHER, C.CONTENT_TYPE_HLS);
|
||||
}
|
||||
}
|
||||
|
@ -525,11 +525,11 @@ public final class ImaAdsLoader implements AdsLoader {
|
||||
List<String> supportedMimeTypes = new ArrayList<>();
|
||||
for (@C.ContentType int contentType : contentTypes) {
|
||||
// IMA does not support Smooth Streaming ad media.
|
||||
if (contentType == C.TYPE_DASH) {
|
||||
if (contentType == C.CONTENT_TYPE_DASH) {
|
||||
supportedMimeTypes.add(MimeTypes.APPLICATION_MPD);
|
||||
} else if (contentType == C.TYPE_HLS) {
|
||||
} else if (contentType == C.CONTENT_TYPE_HLS) {
|
||||
supportedMimeTypes.add(MimeTypes.APPLICATION_M3U8);
|
||||
} else if (contentType == C.TYPE_OTHER) {
|
||||
} else if (contentType == C.CONTENT_TYPE_OTHER) {
|
||||
supportedMimeTypes.addAll(
|
||||
Arrays.asList(
|
||||
MimeTypes.VIDEO_MP4,
|
||||
|
@ -74,7 +74,7 @@ public final class ImaServerSideAdInsertionUriBuilder {
|
||||
public ImaServerSideAdInsertionUriBuilder() {
|
||||
adTagParameters = ImmutableMap.of();
|
||||
loadVideoTimeoutMs = DEFAULT_LOAD_VIDEO_TIMEOUT_MS;
|
||||
format = C.TYPE_OTHER;
|
||||
format = C.CONTENT_TYPE_OTHER;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -143,7 +143,7 @@ public final class ImaServerSideAdInsertionUriBuilder {
|
||||
* @return This instance, for convenience.
|
||||
*/
|
||||
public ImaServerSideAdInsertionUriBuilder setFormat(@ContentType int format) {
|
||||
checkArgument(format == C.TYPE_DASH || format == C.TYPE_HLS);
|
||||
checkArgument(format == C.CONTENT_TYPE_DASH || format == C.CONTENT_TYPE_HLS);
|
||||
this.format = format;
|
||||
return this;
|
||||
}
|
||||
@ -245,7 +245,7 @@ public final class ImaServerSideAdInsertionUriBuilder {
|
||||
|| (!TextUtils.isEmpty(assetKey)
|
||||
&& TextUtils.isEmpty(contentSourceId)
|
||||
&& TextUtils.isEmpty(videoId)));
|
||||
checkState(format != C.TYPE_OTHER);
|
||||
checkState(format != C.CONTENT_TYPE_OTHER);
|
||||
@Nullable String adsId = this.adsId;
|
||||
if (adsId == null) {
|
||||
adsId = assetKey != null ? assetKey : checkNotNull(videoId);
|
||||
@ -332,9 +332,9 @@ public final class ImaServerSideAdInsertionUriBuilder {
|
||||
.createVodStreamRequest(checkNotNull(contentSourceId), checkNotNull(videoId), apiKey);
|
||||
}
|
||||
int format = Integer.parseInt(uri.getQueryParameter(FORMAT));
|
||||
if (format == C.TYPE_DASH) {
|
||||
if (format == C.CONTENT_TYPE_DASH) {
|
||||
streamRequest.setFormat(StreamFormat.DASH);
|
||||
} else if (format == C.TYPE_HLS) {
|
||||
} else if (format == C.CONTENT_TYPE_HLS) {
|
||||
streamRequest.setFormat(StreamFormat.HLS);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unsupported stream format:" + format);
|
||||
|
@ -962,7 +962,7 @@ public final class ImaAdsLoaderTest {
|
||||
|
||||
@Test
|
||||
public void setsDefaultMimeTypes() throws Exception {
|
||||
imaAdsLoader.setSupportedContentTypes(C.TYPE_DASH, C.TYPE_OTHER);
|
||||
imaAdsLoader.setSupportedContentTypes(C.CONTENT_TYPE_DASH, C.CONTENT_TYPE_OTHER);
|
||||
imaAdsLoader.start(
|
||||
adsMediaSource, TEST_DATA_SPEC, TEST_ADS_ID, adViewProvider, adsLoaderListener);
|
||||
|
||||
@ -996,7 +996,7 @@ public final class ImaAdsLoaderTest {
|
||||
adViewProvider);
|
||||
when(mockAdsManager.getAdCuePoints()).thenReturn(PREROLL_CUE_POINTS_SECONDS);
|
||||
|
||||
imaAdsLoader.setSupportedContentTypes(C.TYPE_OTHER);
|
||||
imaAdsLoader.setSupportedContentTypes(C.CONTENT_TYPE_OTHER);
|
||||
imaAdsLoader.start(
|
||||
adsMediaSource, TEST_DATA_SPEC, TEST_ADS_ID, adViewProvider, adsLoaderListener);
|
||||
|
||||
@ -1257,7 +1257,7 @@ public final class ImaAdsLoaderTest {
|
||||
adViewProvider);
|
||||
when(mockAdsManager.getAdCuePoints()).thenReturn(PREROLL_CUE_POINTS_SECONDS);
|
||||
|
||||
imaAdsLoader.setSupportedContentTypes(C.TYPE_OTHER);
|
||||
imaAdsLoader.setSupportedContentTypes(C.CONTENT_TYPE_OTHER);
|
||||
imaAdsLoader.start(
|
||||
adsMediaSource, TEST_DATA_SPEC, TEST_ADS_ID, adViewProvider, adsLoaderListener);
|
||||
|
||||
@ -1283,7 +1283,7 @@ public final class ImaAdsLoaderTest {
|
||||
adViewProvider);
|
||||
when(mockAdsManager.getAdCuePoints()).thenReturn(PREROLL_CUE_POINTS_SECONDS);
|
||||
|
||||
imaAdsLoader.setSupportedContentTypes(C.TYPE_OTHER);
|
||||
imaAdsLoader.setSupportedContentTypes(C.CONTENT_TYPE_OTHER);
|
||||
imaAdsLoader.start(
|
||||
adsMediaSource, TEST_DATA_SPEC, TEST_ADS_ID, adViewProvider, adsLoaderListener);
|
||||
|
||||
|
@ -60,7 +60,7 @@ public final class ImaServerSideAdInsertionUriBuilderTest {
|
||||
builder.setContentUrl(CONTENT_URL);
|
||||
builder.setAuthToken(AUTH_TOKEN);
|
||||
builder.setStreamActivityMonitorId(STREAM_ACTIVITY_MONITOR_ID);
|
||||
builder.setFormat(C.TYPE_HLS);
|
||||
builder.setFormat(C.CONTENT_TYPE_HLS);
|
||||
builder.setAdTagParameters(adTagParameters);
|
||||
builder.setLoadVideoTimeoutMs(ADS_LOADER_TIMEOUT_MS);
|
||||
Uri uri = builder.build();
|
||||
@ -96,7 +96,7 @@ public final class ImaServerSideAdInsertionUriBuilderTest {
|
||||
builder.setContentUrl(CONTENT_URL);
|
||||
builder.setAuthToken(AUTH_TOKEN);
|
||||
builder.setStreamActivityMonitorId(STREAM_ACTIVITY_MONITOR_ID);
|
||||
builder.setFormat(C.TYPE_DASH);
|
||||
builder.setFormat(C.CONTENT_TYPE_DASH);
|
||||
builder.setAdTagParameters(adTagParameters);
|
||||
builder.setLoadVideoTimeoutMs(ADS_LOADER_TIMEOUT_MS);
|
||||
Uri uri = builder.build();
|
||||
@ -127,7 +127,7 @@ public final class ImaServerSideAdInsertionUriBuilderTest {
|
||||
ImaServerSideAdInsertionUriBuilder builder = new ImaServerSideAdInsertionUriBuilder();
|
||||
builder.setContentSourceId(CONTENT_SOURCE_ID);
|
||||
builder.setVideoId(VIDEO_ID);
|
||||
builder.setFormat(C.TYPE_DASH);
|
||||
builder.setFormat(C.CONTENT_TYPE_DASH);
|
||||
|
||||
Uri streamRequest = builder.build();
|
||||
|
||||
@ -139,7 +139,7 @@ public final class ImaServerSideAdInsertionUriBuilderTest {
|
||||
public void build_liveWithNoAdsId_usesAssetKeyAsDefault() {
|
||||
ImaServerSideAdInsertionUriBuilder builder = new ImaServerSideAdInsertionUriBuilder();
|
||||
builder.setAssetKey(ASSET_KEY);
|
||||
builder.setFormat(C.TYPE_DASH);
|
||||
builder.setFormat(C.CONTENT_TYPE_DASH);
|
||||
|
||||
Uri streamRequest = builder.build();
|
||||
|
||||
@ -177,7 +177,7 @@ public final class ImaServerSideAdInsertionUriBuilderTest {
|
||||
Uri uri =
|
||||
new ImaServerSideAdInsertionUriBuilder()
|
||||
.setAssetKey(ASSET_KEY)
|
||||
.setFormat(C.TYPE_DASH)
|
||||
.setFormat(C.CONTENT_TYPE_DASH)
|
||||
.build();
|
||||
|
||||
int loadVideoTimeoutMs = ImaServerSideAdInsertionUriBuilder.getLoadVideoTimeoutMs(uri);
|
||||
|
@ -163,7 +163,7 @@ public final class RtspMediaSource extends BaseMediaSource {
|
||||
|
||||
@Override
|
||||
public int[] getSupportedTypes() {
|
||||
return new int[] {C.TYPE_RTSP};
|
||||
return new int[] {C.CONTENT_TYPE_RTSP};
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -273,7 +273,7 @@ public final class SsMediaSource extends BaseMediaSource
|
||||
|
||||
@Override
|
||||
public int[] getSupportedTypes() {
|
||||
return new int[] {C.TYPE_SS};
|
||||
return new int[] {C.CONTENT_TYPE_SS};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,6 +106,6 @@ public class DefaultMediaSourceFactoryTest {
|
||||
new DefaultMediaSourceFactory((Context) ApplicationProvider.getApplicationContext())
|
||||
.getSupportedTypes();
|
||||
|
||||
assertThat(supportedTypes).asList().containsExactly(C.TYPE_OTHER, C.TYPE_SS);
|
||||
assertThat(supportedTypes).asList().containsExactly(C.CONTENT_TYPE_OTHER, C.CONTENT_TYPE_SS);
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public final class FakeMediaSourceFactory implements MediaSourceFactory {
|
||||
|
||||
@Override
|
||||
public int[] getSupportedTypes() {
|
||||
return new int[] {C.TYPE_OTHER};
|
||||
return new int[] {C.CONTENT_TYPE_OTHER};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user