mirror of
https://github.com/androidx/media.git
synced 2025-05-05 06:30:24 +08:00
Merge remote-tracking branch 'upstream/dev-v2' into dev-v2
This commit is contained in:
commit
1b2157360a
@ -7,25 +7,29 @@
|
|||||||
* Data sources:
|
* Data sources:
|
||||||
* Add support for `android.resource` URI scheme in `RawResourceDataSource`
|
* Add support for `android.resource` URI scheme in `RawResourceDataSource`
|
||||||
([#7866](https://github.com/google/ExoPlayer/issues/7866)).
|
([#7866](https://github.com/google/ExoPlayer/issues/7866)).
|
||||||
* Core library:
|
* Text:
|
||||||
* Suppress Guava-related ProGuard/R8 warnings
|
* Add support for `\h` SSA/ASS style override code (non-breaking space).
|
||||||
([#7904](https://github.com/google/ExoPlayer/issues/7904)).
|
|
||||||
|
|
||||||
### 2.12.0 (2020-09-11) ###
|
### 2.12.0 (2020-09-11) ###
|
||||||
|
|
||||||
|
To learn more about what's new in 2.12, read the corresponding
|
||||||
|
[blog post](https://medium.com/google-exoplayer/exoplayer-2-12-whats-new-e43ef8ff72e7).
|
||||||
|
|
||||||
* Core library:
|
* Core library:
|
||||||
* `Player`:
|
* `Player`:
|
||||||
* Add a top level playlist API based on a new `MediaItem` class
|
* Add a top level playlist API based on a new `MediaItem` class
|
||||||
([#6161](https://github.com/google/ExoPlayer/issues/6161)). The
|
([#6161](https://github.com/google/ExoPlayer/issues/6161)). The new
|
||||||
new methods for playlist manipulation are `setMediaItem(s)`,
|
methods for playlist manipulation are `setMediaItem(s)`,
|
||||||
`addMediaItem(s)`, `moveMediaItem(s)`, `removeMediaItem(s)` and
|
`addMediaItem(s)`, `moveMediaItem(s)`, `removeMediaItem(s)` and
|
||||||
`clearMediaItems`. The playlist can be queried using
|
`clearMediaItems`. The playlist can be queried using
|
||||||
`getMediaItemCount` and `getMediaItemAt`. This API should be used
|
`getMediaItemCount` and `getMediaItemAt`. This API should be used
|
||||||
instead of `ConcatenatingMediaSource` in most cases.
|
instead of `ConcatenatingMediaSource` in most cases. Learn more by
|
||||||
* Add `getCurrentMediaItem` for getting the currently playing item
|
reading
|
||||||
in the playlist.
|
[this blog post](https://medium.com/google-exoplayer/a-top-level-playlist-api-for-exoplayer-abe0a24edb55).
|
||||||
* Add `EventListener.onMediaItemTransition` to report when
|
* Add `getCurrentMediaItem` for getting the currently playing item in
|
||||||
playback transitions from one item to another in the playlist.
|
the playlist.
|
||||||
|
* Add `EventListener.onMediaItemTransition` to report when playback
|
||||||
|
transitions from one item to another in the playlist.
|
||||||
* Add `play` and `pause` convenience methods. They are equivalent to
|
* Add `play` and `pause` convenience methods. They are equivalent to
|
||||||
`setPlayWhenReady(true)` and `setPlayWhenReady(false)` respectively.
|
`setPlayWhenReady(true)` and `setPlayWhenReady(false)` respectively.
|
||||||
* Add `getCurrentLiveOffset` for getting the offset of the current
|
* Add `getCurrentLiveOffset` for getting the offset of the current
|
||||||
@ -34,6 +38,11 @@
|
|||||||
player.
|
player.
|
||||||
* Add `AudioComponent.setAudioSessionId` to set the audio session ID.
|
* Add `AudioComponent.setAudioSessionId` to set the audio session ID.
|
||||||
This method is also available on `SimpleExoPlayer`.
|
This method is also available on `SimpleExoPlayer`.
|
||||||
|
* Remove `PlaybackParameters.skipSilence`, and replace it with
|
||||||
|
`AudioComponent.setSkipSilenceEnabled`. This method is also
|
||||||
|
available on `SimpleExoPlayer`. An
|
||||||
|
`AudioListener.onSkipSilenceEnabledChanged` callback is also
|
||||||
|
added.
|
||||||
* Add `TextComponent.getCurrentCues` to get the current cues. This
|
* Add `TextComponent.getCurrentCues` to get the current cues. This
|
||||||
method is also available on `SimpleExoPlayer`. The current cues are
|
method is also available on `SimpleExoPlayer`. The current cues are
|
||||||
no longer automatically forwarded to a `TextOutput` when it's added
|
no longer automatically forwarded to a `TextOutput` when it's added
|
||||||
@ -87,8 +96,8 @@
|
|||||||
([#7309](https://github.com/google/ExoPlayer/issues/7309)).
|
([#7309](https://github.com/google/ExoPlayer/issues/7309)).
|
||||||
`LoadErrorHandlingPolicy` implementations should migrate to implementing
|
`LoadErrorHandlingPolicy` implementations should migrate to implementing
|
||||||
the non-deprecated methods of the interface.
|
the non-deprecated methods of the interface.
|
||||||
* Add an option to `MergingMediaSource` to adjust the time offsets
|
* Add an option to `MergingMediaSource` to adjust the time offsets between
|
||||||
between the merged sources
|
the merged sources
|
||||||
([#6103](https://github.com/google/ExoPlayer/issues/6103)).
|
([#6103](https://github.com/google/ExoPlayer/issues/6103)).
|
||||||
* Move `MediaSourceEventListener.LoadEventInfo` and
|
* Move `MediaSourceEventListener.LoadEventInfo` and
|
||||||
`MediaSourceEventListener.MediaLoadData` to be top-level classes in
|
`MediaSourceEventListener.MediaLoadData` to be top-level classes in
|
||||||
@ -98,11 +107,10 @@
|
|||||||
generalize them to work with `Decoder` rather than `SimpleDecoder`.
|
generalize them to work with `Decoder` rather than `SimpleDecoder`.
|
||||||
* Deprecate `C.MSG_*` constants, replacing them with constants in
|
* Deprecate `C.MSG_*` constants, replacing them with constants in
|
||||||
`Renderer`.
|
`Renderer`.
|
||||||
* Split the `library-core` module into `library-core`,
|
* Split the `library-core` module into `library-core`, `library-common`
|
||||||
`library-common` and `library-extractor`. The `library-core` module
|
and `library-extractor`. The `library-core` module has an API dependency
|
||||||
has an API dependency on both of the new modules, so this change
|
on both of the new modules, so this change should be transparent to
|
||||||
should be transparent to developers including ExoPlayer using Gradle
|
developers including ExoPlayer using Gradle dependencies.
|
||||||
dependencies.
|
|
||||||
* Add a dependency on Guava.
|
* Add a dependency on Guava.
|
||||||
* Video:
|
* Video:
|
||||||
* Pass frame rate hint to `Surface.setFrameRate` on Android 11.
|
* Pass frame rate hint to `Surface.setFrameRate` on Android 11.
|
||||||
@ -142,6 +150,10 @@
|
|||||||
the `AudioCapabilities`
|
the `AudioCapabilities`
|
||||||
([#7404](https://github.com/google/ExoPlayer/issues/7404)).
|
([#7404](https://github.com/google/ExoPlayer/issues/7404)).
|
||||||
* Text:
|
* Text:
|
||||||
|
* Many of the changes described below improve support for Japanese
|
||||||
|
subtitles. Read
|
||||||
|
[this blog post](https://medium.com/google-exoplayer/improved-japanese-subtitle-support-7598fee12cf4)
|
||||||
|
to learn more.
|
||||||
* Add a WebView-based output option to `SubtitleView`. This can display
|
* Add a WebView-based output option to `SubtitleView`. This can display
|
||||||
some features not supported by the existing Canvas-based output such as
|
some features not supported by the existing Canvas-based output such as
|
||||||
vertical text and rubies. It can be enabled by calling
|
vertical text and rubies. It can be enabled by calling
|
||||||
@ -304,8 +316,8 @@
|
|||||||
* Analytics:
|
* Analytics:
|
||||||
* Extend `EventTime` with more details about the current player state
|
* Extend `EventTime` with more details about the current player state
|
||||||
([#7332](https://github.com/google/ExoPlayer/issues/7332)).
|
([#7332](https://github.com/google/ExoPlayer/issues/7332)).
|
||||||
* Add `AnalyticsListener.onVideoFrameProcessingOffset` to report how
|
* Add `AnalyticsListener.onVideoFrameProcessingOffset` to report how early
|
||||||
early or late video frames are processed relative to them needing to be
|
or late video frames are processed relative to them needing to be
|
||||||
presented. Video frame processing offset fields are also added to
|
presented. Video frame processing offset fields are also added to
|
||||||
`DecoderCounters`.
|
`DecoderCounters`.
|
||||||
* Fix incorrect `MediaPeriodId` for some renderer errors reported by
|
* Fix incorrect `MediaPeriodId` for some renderer errors reported by
|
||||||
@ -315,7 +327,9 @@
|
|||||||
* Test utils: Add `TestExoPlayer`, a utility class with APIs to create
|
* Test utils: Add `TestExoPlayer`, a utility class with APIs to create
|
||||||
`SimpleExoPlayer` instances with fake components for testing.
|
`SimpleExoPlayer` instances with fake components for testing.
|
||||||
* Media2 extension: This is a new extension that makes it easy to use
|
* Media2 extension: This is a new extension that makes it easy to use
|
||||||
ExoPlayer together with AndroidX Media2.
|
ExoPlayer together with AndroidX Media2. Read
|
||||||
|
[this blog post](https://medium.com/google-exoplayer/the-media2-extension-for-exoplayer-d6b7d89b9063)
|
||||||
|
to learn more.
|
||||||
* Cast extension: Implement playlist API and deprecate the old queue
|
* Cast extension: Implement playlist API and deprecate the old queue
|
||||||
manipulation API.
|
manipulation API.
|
||||||
* IMA extension:
|
* IMA extension:
|
||||||
@ -345,11 +359,11 @@
|
|||||||
* Add `clip_start_position_ms` and `clip_end_position_ms` to allow
|
* Add `clip_start_position_ms` and `clip_end_position_ms` to allow
|
||||||
clipped samples.
|
clipped samples.
|
||||||
* Use `StyledPlayerControlView` rather than `PlayerView`.
|
* Use `StyledPlayerControlView` rather than `PlayerView`.
|
||||||
* Remove support for media tunneling, random ABR and playback of
|
* Remove support for media tunneling, random ABR and playback of spherical
|
||||||
spherical video. Developers wishing to experiment with these features
|
video. Developers wishing to experiment with these features can enable
|
||||||
can enable them by modifying the demo app source code.
|
them by modifying the demo app source code.
|
||||||
* Add support for downloading DRM-protected content using offline
|
* Add support for downloading DRM-protected content using offline Widevine
|
||||||
Widevine licenses.
|
licenses.
|
||||||
|
|
||||||
### 2.11.8 (2020-08-25) ###
|
### 2.11.8 (2020-08-25) ###
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ import android.os.Handler;
|
|||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
import androidx.annotation.IntDef;
|
import androidx.annotation.IntDef;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.RequiresApi;
|
import androidx.annotation.RequiresApi;
|
||||||
import com.google.android.exoplayer2.C;
|
import com.google.android.exoplayer2.C;
|
||||||
@ -1694,6 +1695,16 @@ public final class DefaultAudioSink implements AudioSink {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTearDown(@NonNull AudioTrack track) {
|
||||||
|
if (listener != null && playing) {
|
||||||
|
// A new Audio Track needs to be created and it's buffer filled, which will be done on the
|
||||||
|
// next handleBuffer call.
|
||||||
|
// Request this call explicitly in case ExoPlayer is sleeping waiting for a data request.
|
||||||
|
listener.onOffloadBufferEmptying();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void register(AudioTrack audioTrack) {
|
public void register(AudioTrack audioTrack) {
|
||||||
audioTrack.registerStreamEventCallback(handler::post, this);
|
audioTrack.registerStreamEventCallback(handler::post, this);
|
||||||
}
|
}
|
||||||
|
@ -263,8 +263,9 @@ public final class SsaDecoder extends SimpleSubtitleDecoder {
|
|||||||
SsaStyle.Overrides styleOverrides = SsaStyle.Overrides.parseFromDialogue(rawText);
|
SsaStyle.Overrides styleOverrides = SsaStyle.Overrides.parseFromDialogue(rawText);
|
||||||
String text =
|
String text =
|
||||||
SsaStyle.Overrides.stripStyleOverrides(rawText)
|
SsaStyle.Overrides.stripStyleOverrides(rawText)
|
||||||
.replaceAll("\\\\N", "\n")
|
.replace("\\N", "\n")
|
||||||
.replaceAll("\\\\n", "\n");
|
.replace("\\n", "\n")
|
||||||
|
.replace("\\h", "\u00A0");
|
||||||
Cue cue = createCue(text, style, styleOverrides, screenWidth, screenHeight);
|
Cue cue = createCue(text, style, styleOverrides, screenWidth, screenHeight);
|
||||||
|
|
||||||
int startTimeIndex = addCuePlacerholderByTime(startTimeUs, cueTimesUs, cues);
|
int startTimeIndex = addCuePlacerholderByTime(startTimeUs, cueTimesUs, cues);
|
||||||
|
@ -31,11 +31,9 @@ import com.google.common.util.concurrent.ListenableFuture;
|
|||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.robolectric.annotation.LooperMode;
|
|
||||||
|
|
||||||
/** Tests for {@link MetadataRetriever}. */
|
/** Tests for {@link MetadataRetriever}. */
|
||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
@LooperMode(LooperMode.Mode.PAUSED)
|
|
||||||
public class MetadataRetrieverTest {
|
public class MetadataRetrieverTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -100,7 +98,9 @@ public class MetadataRetrieverTest {
|
|||||||
ListenableFuture<TrackGroupArray> trackGroupsFuture)
|
ListenableFuture<TrackGroupArray> trackGroupsFuture)
|
||||||
throws InterruptedException, ExecutionException {
|
throws InterruptedException, ExecutionException {
|
||||||
while (!trackGroupsFuture.isDone()) {
|
while (!trackGroupsFuture.isDone()) {
|
||||||
// Simulate advancing SystemClock so that delayed messages sent to handlers are received.
|
// TODO: update once [Internal: b/168084145] is implemented.
|
||||||
|
// Advance SystemClock so that messages that are sent with a delay to the MetadataRetriever
|
||||||
|
// looper are received.
|
||||||
SystemClock.setCurrentTimeMillis(SystemClock.uptimeMillis() + 100);
|
SystemClock.setCurrentTimeMillis(SystemClock.uptimeMillis() + 100);
|
||||||
Thread.sleep(/* millis= */ 100);
|
Thread.sleep(/* millis= */ 100);
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ public class DumpFileAsserts {
|
|||||||
} else {
|
} else {
|
||||||
File file =
|
File file =
|
||||||
DUMP_FILE_ACTION == WRITE_TO_LOCAL
|
DUMP_FILE_ACTION == WRITE_TO_LOCAL
|
||||||
? new File(StandardSystemProperty.USER_DIR.value(), "../../testdata/src/test")
|
? new File(StandardSystemProperty.USER_DIR.value(), "../../testdata/src/test/assets")
|
||||||
: context.getExternalFilesDir(null);
|
: context.getExternalFilesDir(null);
|
||||||
file = new File(file, dumpFile);
|
file = new File(file, dumpFile);
|
||||||
Assertions.checkStateNotNull(file.getParentFile()).mkdirs();
|
Assertions.checkStateNotNull(file.getParentFile()).mkdirs();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user