Migrate usages of deprecated MediaItem symbols
#minor-release PiperOrigin-RevId: 407847729
This commit is contained in:
parent
ed63fee21c
commit
08d827f2ed
@ -88,8 +88,11 @@ public class DefaultMediaItemConverter implements MediaItemConverter {
|
||||
.setMediaId(mediaId != null ? mediaId : MediaItem.DEFAULT_MEDIA_ID)
|
||||
.setMediaMetadata(new MediaMetadata.Builder().setTitle(title).build())
|
||||
.setTag(media2MediaItem)
|
||||
.setClipStartPositionMs(startPositionMs)
|
||||
.setClipEndPositionMs(endPositionMs)
|
||||
.setClippingConfiguration(
|
||||
new MediaItem.ClippingConfiguration.Builder()
|
||||
.setStartPositionMs(startPositionMs)
|
||||
.setEndPositionMs(endPositionMs)
|
||||
.build())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
@ -301,12 +301,13 @@ public class TimelineTest {
|
||||
window.isSeekable = true;
|
||||
window.isDynamic = true;
|
||||
window.liveConfiguration =
|
||||
new LiveConfiguration(
|
||||
/* targetOffsetMs= */ 1,
|
||||
/* minOffsetMs= */ 2,
|
||||
/* maxOffsetMs= */ 3,
|
||||
/* minPlaybackSpeed= */ 0.5f,
|
||||
/* maxPlaybackSpeed= */ 1.5f);
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(1)
|
||||
.setMinOffsetMs(2)
|
||||
.setMaxOffsetMs(3)
|
||||
.setMinPlaybackSpeed(0.5f)
|
||||
.setMaxPlaybackSpeed(1.5f)
|
||||
.build();
|
||||
window.isPlaceholder = true;
|
||||
window.defaultPositionUs = 444;
|
||||
window.durationUs = 555;
|
||||
|
@ -20,6 +20,7 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import android.net.Uri;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import com.google.android.exoplayer2.MediaItem.SubtitleConfiguration;
|
||||
import com.google.android.exoplayer2.source.ClippingMediaSource;
|
||||
import com.google.android.exoplayer2.text.Cue;
|
||||
import com.google.android.exoplayer2.util.ConditionVariable;
|
||||
@ -44,15 +45,16 @@ public final class ClippedPlaybackTest {
|
||||
MediaItem mediaItem =
|
||||
new MediaItem.Builder()
|
||||
.setUri("asset:///media/mp4/sample.mp4")
|
||||
.setSubtitles(
|
||||
.setSubtitleConfigurations(
|
||||
ImmutableList.of(
|
||||
new MediaItem.Subtitle(
|
||||
Uri.parse("asset:///media/webvtt/typical"),
|
||||
MimeTypes.TEXT_VTT,
|
||||
"en",
|
||||
C.SELECTION_FLAG_DEFAULT)))
|
||||
new SubtitleConfiguration.Builder(Uri.parse("asset:///media/webvtt/typical"))
|
||||
.setMimeType(MimeTypes.TEXT_VTT)
|
||||
.setLanguage("en")
|
||||
.setSelectionFlags(C.SELECTION_FLAG_DEFAULT)
|
||||
.build()))
|
||||
// Expect the clipping to affect both subtitles and video.
|
||||
.setClipEndPositionMs(1000)
|
||||
.setClippingConfiguration(
|
||||
new MediaItem.ClippingConfiguration.Builder().setEndPositionMs(1000).build())
|
||||
.build();
|
||||
AtomicReference<ExoPlayer> player = new AtomicReference<>();
|
||||
TextCapturingPlaybackListener textCapturer = new TextCapturingPlaybackListener();
|
||||
@ -80,21 +82,24 @@ public final class ClippedPlaybackTest {
|
||||
ImmutableList.of(
|
||||
new MediaItem.Builder()
|
||||
.setUri("asset:///media/mp4/sample.mp4")
|
||||
.setSubtitles(
|
||||
.setSubtitleConfigurations(
|
||||
ImmutableList.of(
|
||||
new MediaItem.Subtitle(
|
||||
Uri.parse("asset:///media/webvtt/typical"),
|
||||
MimeTypes.TEXT_VTT,
|
||||
"en",
|
||||
C.SELECTION_FLAG_DEFAULT)))
|
||||
new SubtitleConfiguration.Builder(
|
||||
Uri.parse("asset:///media/webvtt/typical"))
|
||||
.setMimeType(MimeTypes.TEXT_VTT)
|
||||
.setLanguage("en")
|
||||
.setSelectionFlags(C.SELECTION_FLAG_DEFAULT)
|
||||
.build()))
|
||||
// Expect the clipping to affect both subtitles and video.
|
||||
.setClipEndPositionMs(1000)
|
||||
.setClippingConfiguration(
|
||||
new MediaItem.ClippingConfiguration.Builder().setEndPositionMs(1000).build())
|
||||
.build(),
|
||||
new MediaItem.Builder()
|
||||
.setUri("asset:///media/mp4/sample.mp4")
|
||||
// Not needed for correctness, just makes test run faster. Must be longer than the
|
||||
// subtitle content (3.5s).
|
||||
.setClipEndPositionMs(4_000)
|
||||
.setClippingConfiguration(
|
||||
new MediaItem.ClippingConfiguration.Builder().setEndPositionMs(4_000).build())
|
||||
.build());
|
||||
AtomicReference<ExoPlayer> player = new AtomicReference<>();
|
||||
TextCapturingPlaybackListener textCapturer = new TextCapturingPlaybackListener();
|
||||
|
@ -44,12 +44,13 @@ public class DefaultLivePlaybackSpeedControlTest {
|
||||
DefaultLivePlaybackSpeedControl defaultLivePlaybackSpeedControl =
|
||||
new DefaultLivePlaybackSpeedControl.Builder().build();
|
||||
defaultLivePlaybackSpeedControl.setLiveConfiguration(
|
||||
new LiveConfiguration(
|
||||
/* targetLiveOffsetMs= */ 42,
|
||||
/* minLiveOffsetMs= */ 5,
|
||||
/* maxLiveOffsetMs= */ 400,
|
||||
/* minPlaybackSpeed= */ 1f,
|
||||
/* maxPlaybackSpeed= */ 1f));
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(42)
|
||||
.setMinOffsetMs(5)
|
||||
.setMaxOffsetMs(400)
|
||||
.setMinPlaybackSpeed(1f)
|
||||
.setMaxPlaybackSpeed(1f)
|
||||
.build());
|
||||
|
||||
assertThat(defaultLivePlaybackSpeedControl.getTargetLiveOffsetUs()).isEqualTo(42_000);
|
||||
}
|
||||
@ -60,12 +61,13 @@ public class DefaultLivePlaybackSpeedControlTest {
|
||||
DefaultLivePlaybackSpeedControl defaultLivePlaybackSpeedControl =
|
||||
new DefaultLivePlaybackSpeedControl.Builder().build();
|
||||
defaultLivePlaybackSpeedControl.setLiveConfiguration(
|
||||
new LiveConfiguration(
|
||||
/* targetLiveOffsetMs= */ 4321,
|
||||
/* minLiveOffsetMs= */ 5,
|
||||
/* maxLiveOffsetMs= */ 400,
|
||||
/* minPlaybackSpeed= */ 1f,
|
||||
/* maxPlaybackSpeed= */ 1f));
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(4321)
|
||||
.setMinOffsetMs(5)
|
||||
.setMaxOffsetMs(400)
|
||||
.setMinPlaybackSpeed(1f)
|
||||
.setMaxPlaybackSpeed(1f)
|
||||
.build());
|
||||
|
||||
assertThat(defaultLivePlaybackSpeedControl.getTargetLiveOffsetUs()).isEqualTo(400_000);
|
||||
}
|
||||
@ -76,12 +78,13 @@ public class DefaultLivePlaybackSpeedControlTest {
|
||||
DefaultLivePlaybackSpeedControl defaultLivePlaybackSpeedControl =
|
||||
new DefaultLivePlaybackSpeedControl.Builder().build();
|
||||
defaultLivePlaybackSpeedControl.setLiveConfiguration(
|
||||
new LiveConfiguration(
|
||||
/* targetLiveOffsetMs= */ 3,
|
||||
/* minLiveOffsetMs= */ 5,
|
||||
/* maxLiveOffsetMs= */ 400,
|
||||
/* minPlaybackSpeed= */ 1f,
|
||||
/* maxPlaybackSpeed= */ 1f));
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(3)
|
||||
.setMinOffsetMs(5)
|
||||
.setMaxOffsetMs(400)
|
||||
.setMinPlaybackSpeed(1f)
|
||||
.setMaxPlaybackSpeed(1f)
|
||||
.build());
|
||||
|
||||
assertThat(defaultLivePlaybackSpeedControl.getTargetLiveOffsetUs()).isEqualTo(5_000);
|
||||
}
|
||||
@ -93,12 +96,13 @@ public class DefaultLivePlaybackSpeedControlTest {
|
||||
|
||||
defaultLivePlaybackSpeedControl.setTargetLiveOffsetOverrideUs(321_000);
|
||||
defaultLivePlaybackSpeedControl.setLiveConfiguration(
|
||||
new LiveConfiguration(
|
||||
/* targetLiveOffsetMs= */ 42,
|
||||
/* minLiveOffsetMs= */ 5,
|
||||
/* maxLiveOffsetMs= */ 400,
|
||||
/* minPlaybackSpeed= */ 1f,
|
||||
/* maxPlaybackSpeed= */ 1f));
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(42)
|
||||
.setMinOffsetMs(5)
|
||||
.setMaxOffsetMs(400)
|
||||
.setMinPlaybackSpeed(1f)
|
||||
.setMaxPlaybackSpeed(1f)
|
||||
.build());
|
||||
|
||||
long targetLiveOffsetUs = defaultLivePlaybackSpeedControl.getTargetLiveOffsetUs();
|
||||
|
||||
@ -113,12 +117,13 @@ public class DefaultLivePlaybackSpeedControlTest {
|
||||
|
||||
defaultLivePlaybackSpeedControl.setTargetLiveOffsetOverrideUs(123_456_789);
|
||||
defaultLivePlaybackSpeedControl.setLiveConfiguration(
|
||||
new LiveConfiguration(
|
||||
/* targetLiveOffsetMs= */ 42,
|
||||
/* minLiveOffsetMs= */ 5,
|
||||
/* maxLiveOffsetMs= */ 400,
|
||||
/* minPlaybackSpeed= */ 1f,
|
||||
/* maxPlaybackSpeed= */ 1f));
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(42)
|
||||
.setMinOffsetMs(5)
|
||||
.setMaxOffsetMs(400)
|
||||
.setMinPlaybackSpeed(1f)
|
||||
.setMaxPlaybackSpeed(1f)
|
||||
.build());
|
||||
|
||||
long targetLiveOffsetUs = defaultLivePlaybackSpeedControl.getTargetLiveOffsetUs();
|
||||
|
||||
@ -133,12 +138,13 @@ public class DefaultLivePlaybackSpeedControlTest {
|
||||
|
||||
defaultLivePlaybackSpeedControl.setTargetLiveOffsetOverrideUs(3_141);
|
||||
defaultLivePlaybackSpeedControl.setLiveConfiguration(
|
||||
new LiveConfiguration(
|
||||
/* targetLiveOffsetMs= */ 42,
|
||||
/* minLiveOffsetMs= */ 5,
|
||||
/* maxLiveOffsetMs= */ 400,
|
||||
/* minPlaybackSpeed= */ 1f,
|
||||
/* maxPlaybackSpeed= */ 1f));
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(42)
|
||||
.setMinOffsetMs(5)
|
||||
.setMaxOffsetMs(400)
|
||||
.setMinPlaybackSpeed(1f)
|
||||
.setMaxPlaybackSpeed(1f)
|
||||
.build());
|
||||
|
||||
long targetLiveOffsetUs = defaultLivePlaybackSpeedControl.getTargetLiveOffsetUs();
|
||||
|
||||
@ -164,12 +170,13 @@ public class DefaultLivePlaybackSpeedControlTest {
|
||||
new DefaultLivePlaybackSpeedControl.Builder().build();
|
||||
defaultLivePlaybackSpeedControl.setTargetLiveOffsetOverrideUs(123_456_789);
|
||||
defaultLivePlaybackSpeedControl.setLiveConfiguration(
|
||||
new LiveConfiguration(
|
||||
/* targetLiveOffsetMs= */ 42,
|
||||
/* minLiveOffsetMs= */ 5,
|
||||
/* maxLiveOffsetMs= */ 400,
|
||||
/* minPlaybackSpeed= */ 1f,
|
||||
/* maxPlaybackSpeed= */ 1f));
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(42)
|
||||
.setMinOffsetMs(5)
|
||||
.setMaxOffsetMs(400)
|
||||
.setMinPlaybackSpeed(1f)
|
||||
.setMaxPlaybackSpeed(1f)
|
||||
.build());
|
||||
defaultLivePlaybackSpeedControl.setTargetLiveOffsetOverrideUs(C.TIME_UNSET);
|
||||
|
||||
long targetLiveOffsetUs = defaultLivePlaybackSpeedControl.getTargetLiveOffsetUs();
|
||||
@ -184,12 +191,13 @@ public class DefaultLivePlaybackSpeedControlTest {
|
||||
.setTargetLiveOffsetIncrementOnRebufferMs(3)
|
||||
.build();
|
||||
defaultLivePlaybackSpeedControl.setLiveConfiguration(
|
||||
new LiveConfiguration(
|
||||
/* targetLiveOffsetMs= */ 42,
|
||||
/* minLiveOffsetMs= */ 5,
|
||||
/* maxLiveOffsetMs= */ 400,
|
||||
/* minPlaybackSpeed= */ 1f,
|
||||
/* maxPlaybackSpeed= */ 1f));
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(42)
|
||||
.setMinOffsetMs(5)
|
||||
.setMaxOffsetMs(400)
|
||||
.setMinPlaybackSpeed(1f)
|
||||
.setMaxPlaybackSpeed(1f)
|
||||
.build());
|
||||
|
||||
long targetLiveOffsetBeforeUs = defaultLivePlaybackSpeedControl.getTargetLiveOffsetUs();
|
||||
defaultLivePlaybackSpeedControl.notifyRebuffer();
|
||||
@ -206,12 +214,13 @@ public class DefaultLivePlaybackSpeedControlTest {
|
||||
.setTargetLiveOffsetIncrementOnRebufferMs(3)
|
||||
.build();
|
||||
defaultLivePlaybackSpeedControl.setLiveConfiguration(
|
||||
new LiveConfiguration(
|
||||
/* targetLiveOffsetMs= */ 42,
|
||||
/* minLiveOffsetMs= */ 5,
|
||||
/* maxLiveOffsetMs= */ 400,
|
||||
/* minPlaybackSpeed= */ 1f,
|
||||
/* maxPlaybackSpeed= */ 1f));
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(42)
|
||||
.setMinOffsetMs(5)
|
||||
.setMaxOffsetMs(400)
|
||||
.setMinPlaybackSpeed(1f)
|
||||
.setMaxPlaybackSpeed(1f)
|
||||
.build());
|
||||
|
||||
List<Long> targetOffsetsUs = new ArrayList<>();
|
||||
for (int i = 0; i < 500; i++) {
|
||||
@ -231,12 +240,13 @@ public class DefaultLivePlaybackSpeedControlTest {
|
||||
.setTargetLiveOffsetIncrementOnRebufferMs(0)
|
||||
.build();
|
||||
defaultLivePlaybackSpeedControl.setLiveConfiguration(
|
||||
new LiveConfiguration(
|
||||
/* targetLiveOffsetMs= */ 42,
|
||||
/* minLiveOffsetMs= */ 5,
|
||||
/* maxLiveOffsetMs= */ 400,
|
||||
/* minPlaybackSpeed= */ 1f,
|
||||
/* maxPlaybackSpeed= */ 1f));
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(42)
|
||||
.setMinOffsetMs(5)
|
||||
.setMaxOffsetMs(400)
|
||||
.setMinPlaybackSpeed(1f)
|
||||
.setMaxPlaybackSpeed(1f)
|
||||
.build());
|
||||
|
||||
defaultLivePlaybackSpeedControl.notifyRebuffer();
|
||||
long targetLiveOffsetUs = defaultLivePlaybackSpeedControl.getTargetLiveOffsetUs();
|
||||
@ -252,12 +262,13 @@ public class DefaultLivePlaybackSpeedControlTest {
|
||||
.setTargetLiveOffsetIncrementOnRebufferMs(3)
|
||||
.build();
|
||||
defaultLivePlaybackSpeedControl.setLiveConfiguration(
|
||||
new LiveConfiguration(
|
||||
/* targetLiveOffsetMs= */ 42,
|
||||
/* minLiveOffsetMs= */ 5,
|
||||
/* maxLiveOffsetMs= */ 400,
|
||||
/* minPlaybackSpeed= */ 1f,
|
||||
/* maxPlaybackSpeed= */ 1f));
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(42)
|
||||
.setMinOffsetMs(5)
|
||||
.setMaxOffsetMs(400)
|
||||
.setMinPlaybackSpeed(1f)
|
||||
.setMaxPlaybackSpeed(1f)
|
||||
.build());
|
||||
|
||||
defaultLivePlaybackSpeedControl.notifyRebuffer();
|
||||
defaultLivePlaybackSpeedControl.setTargetLiveOffsetOverrideUs(321_000);
|
||||
@ -274,22 +285,24 @@ public class DefaultLivePlaybackSpeedControlTest {
|
||||
.setTargetLiveOffsetIncrementOnRebufferMs(3)
|
||||
.build();
|
||||
defaultLivePlaybackSpeedControl.setLiveConfiguration(
|
||||
new LiveConfiguration(
|
||||
/* targetLiveOffsetMs= */ 42,
|
||||
/* minLiveOffsetMs= */ 5,
|
||||
/* maxLiveOffsetMs= */ 400,
|
||||
/* minPlaybackSpeed= */ 1f,
|
||||
/* maxPlaybackSpeed= */ 1f));
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(42)
|
||||
.setMinOffsetMs(5)
|
||||
.setMaxOffsetMs(400)
|
||||
.setMinPlaybackSpeed(1f)
|
||||
.setMaxPlaybackSpeed(1f)
|
||||
.build());
|
||||
|
||||
long targetLiveOffsetBeforeUs = defaultLivePlaybackSpeedControl.getTargetLiveOffsetUs();
|
||||
defaultLivePlaybackSpeedControl.notifyRebuffer();
|
||||
defaultLivePlaybackSpeedControl.setLiveConfiguration(
|
||||
new LiveConfiguration(
|
||||
/* targetLiveOffsetMs= */ 42,
|
||||
/* minLiveOffsetMs= */ 3,
|
||||
/* maxLiveOffsetMs= */ 450,
|
||||
/* minPlaybackSpeed= */ 0.9f,
|
||||
/* maxPlaybackSpeed= */ 1.1f));
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(42)
|
||||
.setMinOffsetMs(3)
|
||||
.setMaxOffsetMs(450)
|
||||
.setMinPlaybackSpeed(0.9f)
|
||||
.setMaxPlaybackSpeed(1.1f)
|
||||
.build());
|
||||
long targetLiveOffsetAfterUs = defaultLivePlaybackSpeedControl.getTargetLiveOffsetUs();
|
||||
|
||||
assertThat(targetLiveOffsetAfterUs).isGreaterThan(targetLiveOffsetBeforeUs);
|
||||
@ -304,21 +317,23 @@ public class DefaultLivePlaybackSpeedControlTest {
|
||||
.setTargetLiveOffsetIncrementOnRebufferMs(3)
|
||||
.build();
|
||||
defaultLivePlaybackSpeedControl.setLiveConfiguration(
|
||||
new LiveConfiguration(
|
||||
/* targetLiveOffsetMs= */ 42,
|
||||
/* minLiveOffsetMs= */ 5,
|
||||
/* maxLiveOffsetMs= */ 400,
|
||||
/* minPlaybackSpeed= */ 1f,
|
||||
/* maxPlaybackSpeed= */ 1f));
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(42)
|
||||
.setMinOffsetMs(5)
|
||||
.setMaxOffsetMs(400)
|
||||
.setMinPlaybackSpeed(1f)
|
||||
.setMaxPlaybackSpeed(1f)
|
||||
.build());
|
||||
|
||||
defaultLivePlaybackSpeedControl.notifyRebuffer();
|
||||
defaultLivePlaybackSpeedControl.setLiveConfiguration(
|
||||
new LiveConfiguration(
|
||||
/* targetLiveOffsetMs= */ 39,
|
||||
/* minLiveOffsetMs= */ 3,
|
||||
/* maxLiveOffsetMs= */ 450,
|
||||
/* minPlaybackSpeed= */ 0.9f,
|
||||
/* maxPlaybackSpeed= */ 1.1f));
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(39)
|
||||
.setMinOffsetMs(3)
|
||||
.setMaxOffsetMs(450)
|
||||
.setMinPlaybackSpeed(0.9f)
|
||||
.setMaxPlaybackSpeed(1.1f)
|
||||
.build());
|
||||
long targetLiveOffsetUs = defaultLivePlaybackSpeedControl.getTargetLiveOffsetUs();
|
||||
|
||||
assertThat(targetLiveOffsetUs).isEqualTo(39_000);
|
||||
@ -333,12 +348,13 @@ public class DefaultLivePlaybackSpeedControlTest {
|
||||
.setMinUpdateIntervalMs(100)
|
||||
.build();
|
||||
defaultLivePlaybackSpeedControl.setLiveConfiguration(
|
||||
new LiveConfiguration(
|
||||
/* targetLiveOffsetMs= */ 42_000,
|
||||
/* minLiveOffsetMs= */ 5_000,
|
||||
/* maxLiveOffsetMs= */ 400_000,
|
||||
/* minPlaybackSpeed= */ 0.9f,
|
||||
/* maxPlaybackSpeed= */ 1.1f));
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(42_000)
|
||||
.setMinOffsetMs(5_000)
|
||||
.setMaxOffsetMs(400_000)
|
||||
.setMinPlaybackSpeed(0.9f)
|
||||
.setMaxPlaybackSpeed(1.1f)
|
||||
.build());
|
||||
|
||||
defaultLivePlaybackSpeedControl.notifyRebuffer();
|
||||
long targetLiveOffsetAfterRebufferUs = defaultLivePlaybackSpeedControl.getTargetLiveOffsetUs();
|
||||
@ -371,12 +387,13 @@ public class DefaultLivePlaybackSpeedControlTest {
|
||||
.setMinUpdateIntervalMs(100)
|
||||
.build();
|
||||
defaultLivePlaybackSpeedControl.setLiveConfiguration(
|
||||
new LiveConfiguration(
|
||||
/* targetLiveOffsetMs= */ 42_000,
|
||||
/* minLiveOffsetMs= */ 5_000,
|
||||
/* maxLiveOffsetMs= */ 400_000,
|
||||
/* minPlaybackSpeed= */ 0.9f,
|
||||
/* maxPlaybackSpeed= */ 1.1f));
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(42_000)
|
||||
.setMinOffsetMs(5_000)
|
||||
.setMaxOffsetMs(400_000)
|
||||
.setMinPlaybackSpeed(0.9f)
|
||||
.setMaxPlaybackSpeed(1.1f)
|
||||
.build());
|
||||
|
||||
defaultLivePlaybackSpeedControl.notifyRebuffer();
|
||||
long targetLiveOffsetAfterRebufferUs = defaultLivePlaybackSpeedControl.getTargetLiveOffsetUs();
|
||||
@ -408,12 +425,13 @@ public class DefaultLivePlaybackSpeedControlTest {
|
||||
DefaultLivePlaybackSpeedControl defaultLivePlaybackSpeedControl =
|
||||
new DefaultLivePlaybackSpeedControl.Builder().build();
|
||||
defaultLivePlaybackSpeedControl.setLiveConfiguration(
|
||||
new LiveConfiguration(
|
||||
/* targetLiveOffsetMs= */ 42_000,
|
||||
/* minLiveOffsetMs= */ 5_000,
|
||||
/* maxLiveOffsetMs= */ 400_000,
|
||||
/* minPlaybackSpeed= */ 0.9f,
|
||||
/* maxPlaybackSpeed= */ 1.1f));
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(42_000)
|
||||
.setMinOffsetMs(5_000)
|
||||
.setMaxOffsetMs(400_000)
|
||||
.setMinPlaybackSpeed(0.9f)
|
||||
.setMaxPlaybackSpeed(1.1f)
|
||||
.build());
|
||||
|
||||
long targetLiveOffsetBeforeUs = defaultLivePlaybackSpeedControl.getTargetLiveOffsetUs();
|
||||
// Pretend to have a buffered duration at around the target duration with some artificial noise.
|
||||
@ -440,12 +458,13 @@ public class DefaultLivePlaybackSpeedControlTest {
|
||||
.setMinPossibleLiveOffsetSmoothingFactor(0f)
|
||||
.build();
|
||||
defaultLivePlaybackSpeedControl.setLiveConfiguration(
|
||||
new LiveConfiguration(
|
||||
/* targetLiveOffsetMs= */ 42_000,
|
||||
/* minLiveOffsetMs= */ 5_000,
|
||||
/* maxLiveOffsetMs= */ 400_000,
|
||||
/* minPlaybackSpeed= */ 0.9f,
|
||||
/* maxPlaybackSpeed= */ 1.1f));
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(42_000)
|
||||
.setMinOffsetMs(5_000)
|
||||
.setMaxOffsetMs(400_000)
|
||||
.setMinPlaybackSpeed(0.9f)
|
||||
.setMaxPlaybackSpeed(1.1f)
|
||||
.build());
|
||||
|
||||
long targetLiveOffsetBeforeUs = defaultLivePlaybackSpeedControl.getTargetLiveOffsetUs();
|
||||
// Pretend to have a buffered duration at around the target duration with some artificial noise.
|
||||
@ -474,12 +493,13 @@ public class DefaultLivePlaybackSpeedControlTest {
|
||||
.setMinUpdateIntervalMs(100)
|
||||
.build();
|
||||
defaultLivePlaybackSpeedControl.setLiveConfiguration(
|
||||
new LiveConfiguration(
|
||||
/* targetLiveOffsetMs= */ 42_000,
|
||||
/* minLiveOffsetMs= */ 5_000,
|
||||
/* maxLiveOffsetMs= */ 400_000,
|
||||
/* minPlaybackSpeed= */ 0.9f,
|
||||
/* maxPlaybackSpeed= */ 1.1f));
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(42_000)
|
||||
.setMinOffsetMs(5_000)
|
||||
.setMaxOffsetMs(400_000)
|
||||
.setMinPlaybackSpeed(0.9f)
|
||||
.setMaxPlaybackSpeed(1.1f)
|
||||
.build());
|
||||
|
||||
long targetLiveOffsetBeforeUs = defaultLivePlaybackSpeedControl.getTargetLiveOffsetUs();
|
||||
defaultLivePlaybackSpeedControl.getAdjustedPlaybackSpeed(
|
||||
@ -495,12 +515,13 @@ public class DefaultLivePlaybackSpeedControlTest {
|
||||
DefaultLivePlaybackSpeedControl defaultLivePlaybackSpeedControl =
|
||||
new DefaultLivePlaybackSpeedControl.Builder().build();
|
||||
defaultLivePlaybackSpeedControl.setLiveConfiguration(
|
||||
new LiveConfiguration(
|
||||
/* targetLiveOffsetMs= */ 2_000,
|
||||
/* minLiveOffsetMs= */ C.TIME_UNSET,
|
||||
/* maxLiveOffsetMs= */ C.TIME_UNSET,
|
||||
/* minPlaybackSpeed= */ C.RATE_UNSET,
|
||||
/* maxPlaybackSpeed= */ C.RATE_UNSET));
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(2_000)
|
||||
.setMinOffsetMs(C.TIME_UNSET)
|
||||
.setMaxOffsetMs(C.TIME_UNSET)
|
||||
.setMinPlaybackSpeed(C.RATE_UNSET)
|
||||
.setMaxPlaybackSpeed(C.RATE_UNSET)
|
||||
.build());
|
||||
|
||||
float adjustedSpeed =
|
||||
defaultLivePlaybackSpeedControl.getAdjustedPlaybackSpeed(
|
||||
@ -516,12 +537,13 @@ public class DefaultLivePlaybackSpeedControlTest {
|
||||
.setMaxLiveOffsetErrorMsForUnitSpeed(5)
|
||||
.build();
|
||||
defaultLivePlaybackSpeedControl.setLiveConfiguration(
|
||||
new LiveConfiguration(
|
||||
/* targetLiveOffsetMs= */ 2_000,
|
||||
/* minLiveOffsetMs= */ C.TIME_UNSET,
|
||||
/* maxLiveOffsetMs= */ C.TIME_UNSET,
|
||||
/* minPlaybackSpeed= */ C.RATE_UNSET,
|
||||
/* maxPlaybackSpeed= */ C.RATE_UNSET));
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(2_000)
|
||||
.setMinOffsetMs(C.TIME_UNSET)
|
||||
.setMaxOffsetMs(C.TIME_UNSET)
|
||||
.setMinPlaybackSpeed(C.RATE_UNSET)
|
||||
.setMaxPlaybackSpeed(C.RATE_UNSET)
|
||||
.build());
|
||||
|
||||
float adjustedSpeedJustAboveLowerErrorMargin =
|
||||
defaultLivePlaybackSpeedControl.getAdjustedPlaybackSpeed(
|
||||
@ -539,12 +561,13 @@ public class DefaultLivePlaybackSpeedControlTest {
|
||||
DefaultLivePlaybackSpeedControl defaultLivePlaybackSpeedControl =
|
||||
new DefaultLivePlaybackSpeedControl.Builder().setProportionalControlFactor(0.01f).build();
|
||||
defaultLivePlaybackSpeedControl.setLiveConfiguration(
|
||||
new LiveConfiguration(
|
||||
/* targetLiveOffsetMs= */ 2_000,
|
||||
/* minLiveOffsetMs= */ C.TIME_UNSET,
|
||||
/* maxLiveOffsetMs= */ C.TIME_UNSET,
|
||||
/* minPlaybackSpeed= */ C.RATE_UNSET,
|
||||
/* maxPlaybackSpeed= */ C.RATE_UNSET));
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(2_000)
|
||||
.setMinOffsetMs(C.TIME_UNSET)
|
||||
.setMaxOffsetMs(C.TIME_UNSET)
|
||||
.setMinPlaybackSpeed(C.RATE_UNSET)
|
||||
.setMaxPlaybackSpeed(C.RATE_UNSET)
|
||||
.build());
|
||||
|
||||
float adjustedSpeed =
|
||||
defaultLivePlaybackSpeedControl.getAdjustedPlaybackSpeed(
|
||||
@ -561,12 +584,13 @@ public class DefaultLivePlaybackSpeedControlTest {
|
||||
new DefaultLivePlaybackSpeedControl.Builder().setProportionalControlFactor(0.01f).build();
|
||||
defaultLivePlaybackSpeedControl.setTargetLiveOffsetOverrideUs(2_000_000);
|
||||
defaultLivePlaybackSpeedControl.setLiveConfiguration(
|
||||
new LiveConfiguration(
|
||||
/* targetLiveOffsetMs= */ 2_000,
|
||||
/* minLiveOffsetMs= */ C.TIME_UNSET,
|
||||
/* maxLiveOffsetMs= */ C.TIME_UNSET,
|
||||
/* minPlaybackSpeed= */ C.RATE_UNSET,
|
||||
/* maxPlaybackSpeed= */ C.RATE_UNSET));
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(2_000)
|
||||
.setMinOffsetMs(C.TIME_UNSET)
|
||||
.setMaxOffsetMs(C.TIME_UNSET)
|
||||
.setMinPlaybackSpeed(C.RATE_UNSET)
|
||||
.setMaxPlaybackSpeed(C.RATE_UNSET)
|
||||
.build());
|
||||
|
||||
float adjustedSpeed =
|
||||
defaultLivePlaybackSpeedControl.getAdjustedPlaybackSpeed(
|
||||
@ -583,12 +607,13 @@ public class DefaultLivePlaybackSpeedControlTest {
|
||||
DefaultLivePlaybackSpeedControl defaultLivePlaybackSpeedControl =
|
||||
new DefaultLivePlaybackSpeedControl.Builder().setFallbackMaxPlaybackSpeed(1.5f).build();
|
||||
defaultLivePlaybackSpeedControl.setLiveConfiguration(
|
||||
new LiveConfiguration(
|
||||
/* targetLiveOffsetMs= */ 2_000,
|
||||
/* minLiveOffsetMs= */ C.TIME_UNSET,
|
||||
/* maxLiveOffsetMs= */ C.TIME_UNSET,
|
||||
/* minPlaybackSpeed= */ C.RATE_UNSET,
|
||||
/* maxPlaybackSpeed= */ C.RATE_UNSET));
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(2_000)
|
||||
.setMinOffsetMs(C.TIME_UNSET)
|
||||
.setMaxOffsetMs(C.TIME_UNSET)
|
||||
.setMinPlaybackSpeed(C.RATE_UNSET)
|
||||
.setMaxPlaybackSpeed(C.RATE_UNSET)
|
||||
.build());
|
||||
|
||||
float adjustedSpeed =
|
||||
defaultLivePlaybackSpeedControl.getAdjustedPlaybackSpeed(
|
||||
@ -603,12 +628,13 @@ public class DefaultLivePlaybackSpeedControlTest {
|
||||
DefaultLivePlaybackSpeedControl defaultLivePlaybackSpeedControl =
|
||||
new DefaultLivePlaybackSpeedControl.Builder().setFallbackMinPlaybackSpeed(0.5f).build();
|
||||
defaultLivePlaybackSpeedControl.setLiveConfiguration(
|
||||
new LiveConfiguration(
|
||||
/* targetLiveOffsetMs= */ 2_000,
|
||||
/* minLiveOffsetMs= */ C.TIME_UNSET,
|
||||
/* maxLiveOffsetMs= */ C.TIME_UNSET,
|
||||
/* minPlaybackSpeed= */ C.RATE_UNSET,
|
||||
/* maxPlaybackSpeed= */ C.RATE_UNSET));
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(2_000)
|
||||
.setMinOffsetMs(C.TIME_UNSET)
|
||||
.setMaxOffsetMs(C.TIME_UNSET)
|
||||
.setMinPlaybackSpeed(C.RATE_UNSET)
|
||||
.setMaxPlaybackSpeed(C.RATE_UNSET)
|
||||
.build());
|
||||
|
||||
float adjustedSpeed =
|
||||
defaultLivePlaybackSpeedControl.getAdjustedPlaybackSpeed(
|
||||
@ -623,12 +649,13 @@ public class DefaultLivePlaybackSpeedControlTest {
|
||||
DefaultLivePlaybackSpeedControl defaultLivePlaybackSpeedControl =
|
||||
new DefaultLivePlaybackSpeedControl.Builder().setFallbackMaxPlaybackSpeed(1.5f).build();
|
||||
defaultLivePlaybackSpeedControl.setLiveConfiguration(
|
||||
new LiveConfiguration(
|
||||
/* targetLiveOffsetMs= */ 2_000,
|
||||
/* minLiveOffsetMs= */ C.TIME_UNSET,
|
||||
/* maxLiveOffsetMs= */ C.TIME_UNSET,
|
||||
/* minPlaybackSpeed= */ C.RATE_UNSET,
|
||||
/* maxPlaybackSpeed= */ 2f));
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(2_000)
|
||||
.setMinOffsetMs(C.TIME_UNSET)
|
||||
.setMaxOffsetMs(C.TIME_UNSET)
|
||||
.setMinPlaybackSpeed(C.RATE_UNSET)
|
||||
.setMaxPlaybackSpeed(2f)
|
||||
.build());
|
||||
|
||||
float adjustedSpeed =
|
||||
defaultLivePlaybackSpeedControl.getAdjustedPlaybackSpeed(
|
||||
@ -643,12 +670,13 @@ public class DefaultLivePlaybackSpeedControlTest {
|
||||
DefaultLivePlaybackSpeedControl defaultLivePlaybackSpeedControl =
|
||||
new DefaultLivePlaybackSpeedControl.Builder().setFallbackMinPlaybackSpeed(0.5f).build();
|
||||
defaultLivePlaybackSpeedControl.setLiveConfiguration(
|
||||
new LiveConfiguration(
|
||||
/* targetLiveOffsetMs= */ 2_000,
|
||||
/* minLiveOffsetMs= */ C.TIME_UNSET,
|
||||
/* maxLiveOffsetMs= */ C.TIME_UNSET,
|
||||
/* minPlaybackSpeed= */ 0.2f,
|
||||
/* maxPlaybackSpeed= */ C.RATE_UNSET));
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(2_000)
|
||||
.setMinOffsetMs(C.TIME_UNSET)
|
||||
.setMaxOffsetMs(C.TIME_UNSET)
|
||||
.setMinPlaybackSpeed(0.2f)
|
||||
.setMaxPlaybackSpeed(C.RATE_UNSET)
|
||||
.build());
|
||||
|
||||
float adjustedSpeed =
|
||||
defaultLivePlaybackSpeedControl.getAdjustedPlaybackSpeed(
|
||||
@ -662,12 +690,13 @@ public class DefaultLivePlaybackSpeedControlTest {
|
||||
DefaultLivePlaybackSpeedControl defaultLivePlaybackSpeedControl =
|
||||
new DefaultLivePlaybackSpeedControl.Builder().setMinUpdateIntervalMs(123).build();
|
||||
defaultLivePlaybackSpeedControl.setLiveConfiguration(
|
||||
new LiveConfiguration(
|
||||
/* targetLiveOffsetMs= */ 2_000,
|
||||
/* minLiveOffsetMs= */ C.TIME_UNSET,
|
||||
/* maxLiveOffsetMs= */ C.TIME_UNSET,
|
||||
/* minPlaybackSpeed= */ C.RATE_UNSET,
|
||||
/* maxPlaybackSpeed= */ C.RATE_UNSET));
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(2_000)
|
||||
.setMinOffsetMs(C.TIME_UNSET)
|
||||
.setMaxOffsetMs(C.TIME_UNSET)
|
||||
.setMinPlaybackSpeed(C.RATE_UNSET)
|
||||
.setMaxPlaybackSpeed(C.RATE_UNSET)
|
||||
.build());
|
||||
|
||||
float adjustedSpeed1 =
|
||||
defaultLivePlaybackSpeedControl.getAdjustedPlaybackSpeed(
|
||||
@ -691,23 +720,25 @@ public class DefaultLivePlaybackSpeedControlTest {
|
||||
DefaultLivePlaybackSpeedControl defaultLivePlaybackSpeedControl =
|
||||
new DefaultLivePlaybackSpeedControl.Builder().setMinUpdateIntervalMs(123).build();
|
||||
defaultLivePlaybackSpeedControl.setLiveConfiguration(
|
||||
new LiveConfiguration(
|
||||
/* targetLiveOffsetMs= */ 2_000,
|
||||
/* minLiveOffsetMs= */ C.TIME_UNSET,
|
||||
/* maxLiveOffsetMs= */ C.TIME_UNSET,
|
||||
/* minPlaybackSpeed= */ C.RATE_UNSET,
|
||||
/* maxPlaybackSpeed= */ C.RATE_UNSET));
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(2_000)
|
||||
.setMinOffsetMs(C.TIME_UNSET)
|
||||
.setMaxOffsetMs(C.TIME_UNSET)
|
||||
.setMinPlaybackSpeed(C.RATE_UNSET)
|
||||
.setMaxPlaybackSpeed(C.RATE_UNSET)
|
||||
.build());
|
||||
|
||||
float adjustedSpeed1 =
|
||||
defaultLivePlaybackSpeedControl.getAdjustedPlaybackSpeed(
|
||||
/* liveOffsetUs= */ 1_500_000, /* bufferedDurationUs= */ 1_000_000);
|
||||
defaultLivePlaybackSpeedControl.setLiveConfiguration(
|
||||
new LiveConfiguration(
|
||||
/* targetLiveOffsetMs= */ 2_000,
|
||||
/* minLiveOffsetMs= */ C.TIME_UNSET,
|
||||
/* maxLiveOffsetMs= */ C.TIME_UNSET,
|
||||
/* minPlaybackSpeed= */ C.RATE_UNSET,
|
||||
/* maxPlaybackSpeed= */ C.RATE_UNSET));
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(2_000)
|
||||
.setMinOffsetMs(C.TIME_UNSET)
|
||||
.setMaxOffsetMs(C.TIME_UNSET)
|
||||
.setMinPlaybackSpeed(C.RATE_UNSET)
|
||||
.setMaxPlaybackSpeed(C.RATE_UNSET)
|
||||
.build());
|
||||
float adjustedSpeed2 =
|
||||
defaultLivePlaybackSpeedControl.getAdjustedPlaybackSpeed(
|
||||
/* liveOffsetUs= */ 2_500_000, /* bufferedDurationUs= */ 1_000_000);
|
||||
@ -721,23 +752,25 @@ public class DefaultLivePlaybackSpeedControlTest {
|
||||
DefaultLivePlaybackSpeedControl defaultLivePlaybackSpeedControl =
|
||||
new DefaultLivePlaybackSpeedControl.Builder().setMinUpdateIntervalMs(123).build();
|
||||
defaultLivePlaybackSpeedControl.setLiveConfiguration(
|
||||
new LiveConfiguration(
|
||||
/* targetLiveOffsetMs= */ 2_000,
|
||||
/* minLiveOffsetMs= */ C.TIME_UNSET,
|
||||
/* maxLiveOffsetMs= */ C.TIME_UNSET,
|
||||
/* minPlaybackSpeed= */ C.RATE_UNSET,
|
||||
/* maxPlaybackSpeed= */ C.RATE_UNSET));
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(2_000)
|
||||
.setMinOffsetMs(C.TIME_UNSET)
|
||||
.setMaxOffsetMs(C.TIME_UNSET)
|
||||
.setMinPlaybackSpeed(C.RATE_UNSET)
|
||||
.setMaxPlaybackSpeed(C.RATE_UNSET)
|
||||
.build());
|
||||
|
||||
float adjustedSpeed1 =
|
||||
defaultLivePlaybackSpeedControl.getAdjustedPlaybackSpeed(
|
||||
/* liveOffsetUs= */ 1_500_000, /* bufferedDurationUs= */ 1_000_000);
|
||||
defaultLivePlaybackSpeedControl.setLiveConfiguration(
|
||||
new LiveConfiguration(
|
||||
/* targetLiveOffsetMs= */ 1_000,
|
||||
/* minLiveOffsetMs= */ C.TIME_UNSET,
|
||||
/* maxLiveOffsetMs= */ C.TIME_UNSET,
|
||||
/* minPlaybackSpeed= */ C.RATE_UNSET,
|
||||
/* maxPlaybackSpeed= */ C.RATE_UNSET));
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(1_000)
|
||||
.setMinOffsetMs(C.TIME_UNSET)
|
||||
.setMaxOffsetMs(C.TIME_UNSET)
|
||||
.setMinPlaybackSpeed(C.RATE_UNSET)
|
||||
.setMaxPlaybackSpeed(C.RATE_UNSET)
|
||||
.build());
|
||||
float adjustedSpeed2 =
|
||||
defaultLivePlaybackSpeedControl.getAdjustedPlaybackSpeed(
|
||||
/* liveOffsetUs= */ 2_500_000, /* bufferedDurationUs= */ 1_000_000);
|
||||
@ -751,12 +784,13 @@ public class DefaultLivePlaybackSpeedControlTest {
|
||||
DefaultLivePlaybackSpeedControl defaultLivePlaybackSpeedControl =
|
||||
new DefaultLivePlaybackSpeedControl.Builder().setMinUpdateIntervalMs(123).build();
|
||||
defaultLivePlaybackSpeedControl.setLiveConfiguration(
|
||||
new LiveConfiguration(
|
||||
/* targetLiveOffsetMs= */ 2_000,
|
||||
/* minLiveOffsetMs= */ C.TIME_UNSET,
|
||||
/* maxLiveOffsetMs= */ C.TIME_UNSET,
|
||||
/* minPlaybackSpeed= */ C.RATE_UNSET,
|
||||
/* maxPlaybackSpeed= */ C.RATE_UNSET));
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(2_000)
|
||||
.setMinOffsetMs(C.TIME_UNSET)
|
||||
.setMaxOffsetMs(C.TIME_UNSET)
|
||||
.setMinPlaybackSpeed(C.RATE_UNSET)
|
||||
.setMaxPlaybackSpeed(C.RATE_UNSET)
|
||||
.build());
|
||||
|
||||
float adjustedSpeed1 =
|
||||
defaultLivePlaybackSpeedControl.getAdjustedPlaybackSpeed(
|
||||
@ -774,12 +808,13 @@ public class DefaultLivePlaybackSpeedControlTest {
|
||||
DefaultLivePlaybackSpeedControl defaultLivePlaybackSpeedControl =
|
||||
new DefaultLivePlaybackSpeedControl.Builder().setMinUpdateIntervalMs(123).build();
|
||||
defaultLivePlaybackSpeedControl.setLiveConfiguration(
|
||||
new LiveConfiguration(
|
||||
/* targetLiveOffsetMs= */ 2_000,
|
||||
/* minLiveOffsetMs= */ C.TIME_UNSET,
|
||||
/* maxLiveOffsetMs= */ C.TIME_UNSET,
|
||||
/* minPlaybackSpeed= */ C.RATE_UNSET,
|
||||
/* maxPlaybackSpeed= */ C.RATE_UNSET));
|
||||
new LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(2_000)
|
||||
.setMinOffsetMs(C.TIME_UNSET)
|
||||
.setMaxOffsetMs(C.TIME_UNSET)
|
||||
.setMinPlaybackSpeed(C.RATE_UNSET)
|
||||
.setMaxPlaybackSpeed(C.RATE_UNSET)
|
||||
.build());
|
||||
|
||||
float adjustedSpeed1 =
|
||||
defaultLivePlaybackSpeedControl.getAdjustedPlaybackSpeed(
|
||||
|
@ -93,12 +93,22 @@ public final class DefaultMediaSourceFactoryTest {
|
||||
public void createMediaSource_withSubtitle_isMergingMediaSource() {
|
||||
DefaultMediaSourceFactory defaultMediaSourceFactory =
|
||||
new DefaultMediaSourceFactory((Context) ApplicationProvider.getApplicationContext());
|
||||
List<MediaItem.Subtitle> subtitles =
|
||||
List<MediaItem.SubtitleConfiguration> subtitleConfigurations =
|
||||
Arrays.asList(
|
||||
new MediaItem.Subtitle(Uri.parse(URI_TEXT), MimeTypes.APPLICATION_TTML, "en"),
|
||||
new MediaItem.Subtitle(
|
||||
Uri.parse(URI_TEXT), MimeTypes.APPLICATION_TTML, "de", C.SELECTION_FLAG_DEFAULT));
|
||||
MediaItem mediaItem = new MediaItem.Builder().setUri(URI_MEDIA).setSubtitles(subtitles).build();
|
||||
new MediaItem.SubtitleConfiguration.Builder(Uri.parse(URI_TEXT))
|
||||
.setMimeType(MimeTypes.APPLICATION_TTML)
|
||||
.setLanguage("en")
|
||||
.build(),
|
||||
new MediaItem.SubtitleConfiguration.Builder(Uri.parse(URI_TEXT))
|
||||
.setMimeType(MimeTypes.APPLICATION_TTML)
|
||||
.setLanguage("de")
|
||||
.setSelectionFlags(C.SELECTION_FLAG_DEFAULT)
|
||||
.build());
|
||||
MediaItem mediaItem =
|
||||
new MediaItem.Builder()
|
||||
.setUri(URI_MEDIA)
|
||||
.setSubtitleConfigurations(subtitleConfigurations)
|
||||
.build();
|
||||
|
||||
MediaSource mediaSource = defaultMediaSourceFactory.createMediaSource(mediaItem);
|
||||
|
||||
@ -110,7 +120,11 @@ public final class DefaultMediaSourceFactoryTest {
|
||||
DefaultMediaSourceFactory defaultMediaSourceFactory =
|
||||
new DefaultMediaSourceFactory((Context) ApplicationProvider.getApplicationContext());
|
||||
MediaItem mediaItem =
|
||||
new MediaItem.Builder().setUri(URI_MEDIA).setClipStartPositionMs(1000L).build();
|
||||
new MediaItem.Builder()
|
||||
.setUri(URI_MEDIA)
|
||||
.setClippingConfiguration(
|
||||
new MediaItem.ClippingConfiguration.Builder().setStartPositionMs(1000L).build())
|
||||
.build();
|
||||
|
||||
MediaSource mediaSource = defaultMediaSourceFactory.createMediaSource(mediaItem);
|
||||
|
||||
@ -122,7 +136,11 @@ public final class DefaultMediaSourceFactoryTest {
|
||||
DefaultMediaSourceFactory defaultMediaSourceFactory =
|
||||
new DefaultMediaSourceFactory((Context) ApplicationProvider.getApplicationContext());
|
||||
MediaItem mediaItem =
|
||||
new MediaItem.Builder().setUri(URI_MEDIA).setClipEndPositionMs(1000L).build();
|
||||
new MediaItem.Builder()
|
||||
.setUri(URI_MEDIA)
|
||||
.setClippingConfiguration(
|
||||
new MediaItem.ClippingConfiguration.Builder().setEndPositionMs(1000L).build())
|
||||
.build();
|
||||
|
||||
MediaSource mediaSource = defaultMediaSourceFactory.createMediaSource(mediaItem);
|
||||
|
||||
@ -134,7 +152,13 @@ public final class DefaultMediaSourceFactoryTest {
|
||||
DefaultMediaSourceFactory defaultMediaSourceFactory =
|
||||
new DefaultMediaSourceFactory((Context) ApplicationProvider.getApplicationContext());
|
||||
MediaItem mediaItem =
|
||||
new MediaItem.Builder().setUri(URI_MEDIA).setClipRelativeToDefaultPosition(true).build();
|
||||
new MediaItem.Builder()
|
||||
.setUri(URI_MEDIA)
|
||||
.setClippingConfiguration(
|
||||
new MediaItem.ClippingConfiguration.Builder()
|
||||
.setRelativeToDefaultPosition(true)
|
||||
.build())
|
||||
.build();
|
||||
|
||||
MediaSource mediaSource = defaultMediaSourceFactory.createMediaSource(mediaItem);
|
||||
|
||||
@ -148,7 +172,10 @@ public final class DefaultMediaSourceFactoryTest {
|
||||
MediaItem mediaItem =
|
||||
new MediaItem.Builder()
|
||||
.setUri(URI_MEDIA)
|
||||
.setClipEndPositionMs(C.TIME_END_OF_SOURCE)
|
||||
.setClippingConfiguration(
|
||||
new MediaItem.ClippingConfiguration.Builder()
|
||||
.setEndPositionMs(C.TIME_END_OF_SOURCE)
|
||||
.build())
|
||||
.build();
|
||||
|
||||
MediaSource mediaSource = defaultMediaSourceFactory.createMediaSource(mediaItem);
|
||||
|
@ -1053,8 +1053,13 @@ public final class DashMediaSource extends BaseMediaSource {
|
||||
maxPlaybackSpeed = manifest.serviceDescription.maxPlaybackSpeed;
|
||||
}
|
||||
liveConfiguration =
|
||||
new MediaItem.LiveConfiguration(
|
||||
targetOffsetMs, minLiveOffsetMs, maxLiveOffsetMs, minPlaybackSpeed, maxPlaybackSpeed);
|
||||
new MediaItem.LiveConfiguration.Builder()
|
||||
.setTargetOffsetMs(targetOffsetMs)
|
||||
.setMinOffsetMs(minLiveOffsetMs)
|
||||
.setMaxOffsetMs(maxLiveOffsetMs)
|
||||
.setMinPlaybackSpeed(minPlaybackSpeed)
|
||||
.setMaxPlaybackSpeed(maxPlaybackSpeed)
|
||||
.build();
|
||||
}
|
||||
|
||||
private void scheduleManifestRefresh(long delayUntilNextLoadMs) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user