mirror of
https://github.com/androidx/media.git
synced 2025-05-10 09:12:16 +08:00
Migrate uses of prepare(MediaSource) to setMediaSource() & prepare()
PiperOrigin-RevId: 321147910
This commit is contained in:
parent
425d48b67a
commit
f83d478cc3
@ -42,6 +42,7 @@ public final class ConcatenatingMediaSourcePlaybackPreparer implements PlaybackP
|
||||
|
||||
@Override
|
||||
public void preparePlayback() {
|
||||
exoPlayer.prepare(concatenatingMediaSource);
|
||||
exoPlayer.setMediaSource(concatenatingMediaSource);
|
||||
exoPlayer.prepare();
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,8 @@ public class OpusPlaybackTest {
|
||||
new DefaultDataSourceFactory(context, "ExoPlayerExtOpusTest"),
|
||||
MatroskaExtractor.FACTORY)
|
||||
.createMediaSource(MediaItem.fromUri(uri));
|
||||
player.prepare(mediaSource);
|
||||
player.setMediaSource(mediaSource);
|
||||
player.prepare();
|
||||
player.play();
|
||||
Looper.loop();
|
||||
}
|
||||
|
@ -128,7 +128,8 @@ public class VpxPlaybackTest {
|
||||
.setType(C.MSG_SET_VIDEO_DECODER_OUTPUT_BUFFER_RENDERER)
|
||||
.setPayload(new VideoDecoderGLSurfaceView(context).getVideoDecoderOutputBufferRenderer())
|
||||
.send();
|
||||
player.prepare(mediaSource);
|
||||
player.setMediaSource(mediaSource);
|
||||
player.prepare();
|
||||
player.play();
|
||||
Looper.loop();
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ import java.util.List;
|
||||
* <ul>
|
||||
* <li>A <b>{@link MediaSource}</b> that defines the media to be played, loads the media, and from
|
||||
* which the loaded media can be read. A MediaSource is injected via {@link
|
||||
* #prepare(MediaSource)} at the start of playback. The library modules provide default
|
||||
* #setMediaSource(MediaSource)} at the start of playback. The library modules provide default
|
||||
* implementations for progressive media files ({@link ProgressiveMediaSource}), DASH
|
||||
* (DashMediaSource), SmoothStreaming (SsMediaSource) and HLS (HlsMediaSource), an
|
||||
* implementation for loading single media samples ({@link SingleSampleMediaSource}) that's
|
||||
|
@ -3526,6 +3526,7 @@ public final class ExoPlayerTest {
|
||||
assertArrayEquals(new long[] {5_000}, currentPlaybackPositions);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Test
|
||||
public void seekTo_windowIndexIsReset_deprecated() throws Exception {
|
||||
FakeTimeline fakeTimeline = new FakeTimeline(/* windowCount= */ 1);
|
||||
@ -3542,7 +3543,6 @@ public final class ExoPlayerTest {
|
||||
new PlayerRunnable() {
|
||||
@Override
|
||||
public void run(SimpleExoPlayer player) {
|
||||
//noinspection deprecation
|
||||
player.prepare(mediaSource);
|
||||
player.seekTo(/* positionMs= */ 5000);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user