Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3d3c90b8
authored
Apr 01, 2021
by
samrobinson
Committed by
Oliver Woodman
Apr 01, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add getMediaMetadata to Player and SimpleExoPlayer.
PiperOrigin-RevId: 366240390
parent
a317746e
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
44 additions
and
0 deletions
RELEASENOTES.md
extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/CastPlayer.java
library/common/src/main/java/com/google/android/exoplayer2/Player.java
library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImpl.java
library/core/src/main/java/com/google/android/exoplayer2/SimpleExoPlayer.java
testutils/src/main/java/com/google/android/exoplayer2/testutil/StubExoPlayer.java
RELEASENOTES.md
View file @
3d3c90b8
...
@@ -49,6 +49,7 @@
...
@@ -49,6 +49,7 @@
*
Core:
*
Core:
*
Move
`getRendererCount`
and
`getRendererType`
methods from
`Player`
to
*
Move
`getRendererCount`
and
`getRendererType`
methods from
`Player`
to
`ExoPlayer`
.
`ExoPlayer`
.
*
Add
`getMediaMetadata`
to
`Player`
interface.
*
Reset playback speed when live playback speed control becomes unused
*
Reset playback speed when live playback speed control becomes unused
(
[
#8664
](
https://github.com/google/ExoPlayer/issues/8664
)
).
(
[
#8664
](
https://github.com/google/ExoPlayer/issues/8664
)
).
*
Fix playback position issue when re-preparing playback after a
*
Fix playback position issue when re-preparing playback after a
...
...
extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/CastPlayer.java
View file @
3d3c90b8
...
@@ -25,6 +25,7 @@ import com.google.android.exoplayer2.C;
...
@@ -25,6 +25,7 @@ import com.google.android.exoplayer2.C;
import
com.google.android.exoplayer2.ExoPlaybackException
;
import
com.google.android.exoplayer2.ExoPlaybackException
;
import
com.google.android.exoplayer2.ExoPlayerLibraryInfo
;
import
com.google.android.exoplayer2.ExoPlayerLibraryInfo
;
import
com.google.android.exoplayer2.MediaItem
;
import
com.google.android.exoplayer2.MediaItem
;
import
com.google.android.exoplayer2.MediaMetadata
;
import
com.google.android.exoplayer2.PlaybackParameters
;
import
com.google.android.exoplayer2.PlaybackParameters
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.Timeline
;
import
com.google.android.exoplayer2.Timeline
;
...
@@ -567,6 +568,12 @@ public final class CastPlayer extends BasePlayer {
...
@@ -567,6 +568,12 @@ public final class CastPlayer extends BasePlayer {
}
}
@Override
@Override
public
MediaMetadata
getMediaMetadata
()
{
// CastPlayer does not currently support metadata.
return
MediaMetadata
.
EMPTY
;
}
@Override
public
Timeline
getCurrentTimeline
()
{
public
Timeline
getCurrentTimeline
()
{
return
currentTimeline
;
return
currentTimeline
;
}
}
...
...
library/common/src/main/java/com/google/android/exoplayer2/Player.java
View file @
3d3c90b8
...
@@ -35,6 +35,7 @@ import com.google.android.exoplayer2.text.Cue;
...
@@ -35,6 +35,7 @@ import com.google.android.exoplayer2.text.Cue;
import
com.google.android.exoplayer2.text.TextOutput
;
import
com.google.android.exoplayer2.text.TextOutput
;
import
com.google.android.exoplayer2.trackselection.TrackSelectionArray
;
import
com.google.android.exoplayer2.trackselection.TrackSelectionArray
;
import
com.google.android.exoplayer2.util.ExoFlags
;
import
com.google.android.exoplayer2.util.ExoFlags
;
import
com.google.android.exoplayer2.util.StableApiCandidate
;
import
com.google.android.exoplayer2.util.Util
;
import
com.google.android.exoplayer2.util.Util
;
import
com.google.android.exoplayer2.video.VideoFrameMetadataListener
;
import
com.google.android.exoplayer2.video.VideoFrameMetadataListener
;
import
com.google.android.exoplayer2.video.VideoListener
;
import
com.google.android.exoplayer2.video.VideoListener
;
...
@@ -1750,6 +1751,16 @@ public interface Player {
...
@@ -1750,6 +1751,16 @@ public interface Player {
List
<
Metadata
>
getCurrentStaticMetadata
();
List
<
Metadata
>
getCurrentStaticMetadata
();
/**
/**
* Returns the current combined {@link MediaMetadata}, or {@link MediaMetadata#EMPTY} if not
* supported.
*
* <p>This {@link MediaMetadata} is a combination of the {@link MediaItem#mediaMetadata} and the
* static and dynamic metadata sourced from {@link EventListener#onStaticMetadataChanged(List)}
* and {@link MetadataOutput#onMetadata(Metadata)}.
*/
MediaMetadata
getMediaMetadata
();
/**
* Returns the current manifest. The type depends on the type of media being played. May be null.
* Returns the current manifest. The type depends on the type of media being played. May be null.
*/
*/
@Nullable
@Nullable
...
...
library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImpl.java
View file @
3d3c90b8
...
@@ -975,6 +975,12 @@ import java.util.concurrent.CopyOnWriteArraySet;
...
@@ -975,6 +975,12 @@ import java.util.concurrent.CopyOnWriteArraySet;
}
}
@Override
@Override
public
MediaMetadata
getMediaMetadata
()
{
// Unsupported operation.
return
MediaMetadata
.
EMPTY
;
}
@Override
public
Timeline
getCurrentTimeline
()
{
public
Timeline
getCurrentTimeline
()
{
return
playbackInfo
.
timeline
;
return
playbackInfo
.
timeline
;
}
}
...
...
library/core/src/main/java/com/google/android/exoplayer2/SimpleExoPlayer.java
View file @
3d3c90b8
...
@@ -609,6 +609,7 @@ public class SimpleExoPlayer extends BasePlayer
...
@@ -609,6 +609,7 @@ public class SimpleExoPlayer extends BasePlayer
private
boolean
isPriorityTaskManagerRegistered
;
private
boolean
isPriorityTaskManagerRegistered
;
private
boolean
playerReleased
;
private
boolean
playerReleased
;
private
DeviceInfo
deviceInfo
;
private
DeviceInfo
deviceInfo
;
private
MediaMetadata
currentMediaMetadata
;
/** @deprecated Use the {@link Builder} and pass it to {@link #SimpleExoPlayer(Builder)}. */
/** @deprecated Use the {@link Builder} and pass it to {@link #SimpleExoPlayer(Builder)}. */
@Deprecated
@Deprecated
...
@@ -716,6 +717,7 @@ public class SimpleExoPlayer extends BasePlayer
...
@@ -716,6 +717,7 @@ public class SimpleExoPlayer extends BasePlayer
wifiLockManager
=
new
WifiLockManager
(
builder
.
context
);
wifiLockManager
=
new
WifiLockManager
(
builder
.
context
);
wifiLockManager
.
setEnabled
(
builder
.
wakeMode
==
C
.
WAKE_MODE_NETWORK
);
wifiLockManager
.
setEnabled
(
builder
.
wakeMode
==
C
.
WAKE_MODE_NETWORK
);
deviceInfo
=
createDeviceInfo
(
streamVolumeManager
);
deviceInfo
=
createDeviceInfo
(
streamVolumeManager
);
currentMediaMetadata
=
MediaMetadata
.
EMPTY
;
sendRendererMessage
(
C
.
TRACK_TYPE_AUDIO
,
Renderer
.
MSG_SET_AUDIO_SESSION_ID
,
audioSessionId
);
sendRendererMessage
(
C
.
TRACK_TYPE_AUDIO
,
Renderer
.
MSG_SET_AUDIO_SESSION_ID
,
audioSessionId
);
sendRendererMessage
(
C
.
TRACK_TYPE_VIDEO
,
Renderer
.
MSG_SET_AUDIO_SESSION_ID
,
audioSessionId
);
sendRendererMessage
(
C
.
TRACK_TYPE_VIDEO
,
Renderer
.
MSG_SET_AUDIO_SESSION_ID
,
audioSessionId
);
...
@@ -1621,6 +1623,11 @@ public class SimpleExoPlayer extends BasePlayer
...
@@ -1621,6 +1623,11 @@ public class SimpleExoPlayer extends BasePlayer
}
}
@Override
@Override
public
MediaMetadata
getMediaMetadata
()
{
return
currentMediaMetadata
;
}
@Override
public
Timeline
getCurrentTimeline
()
{
public
Timeline
getCurrentTimeline
()
{
verifyApplicationThread
();
verifyApplicationThread
();
return
player
.
getCurrentTimeline
();
return
player
.
getCurrentTimeline
();
...
@@ -2276,6 +2283,12 @@ public class SimpleExoPlayer extends BasePlayer
...
@@ -2276,6 +2283,12 @@ public class SimpleExoPlayer extends BasePlayer
}
}
@Override
@Override
public
void
onMediaItemTransition
(
@Nullable
MediaItem
mediaItem
,
@MediaItemTransitionReason
int
reason
)
{
currentMediaMetadata
=
mediaItem
==
null
?
MediaMetadata
.
EMPTY
:
mediaItem
.
mediaMetadata
;
}
@Override
public
void
onPlaybackStateChanged
(
@State
int
playbackState
)
{
public
void
onPlaybackStateChanged
(
@State
int
playbackState
)
{
updateWakeAndWifiLock
();
updateWakeAndWifiLock
();
}
}
...
...
testutils/src/main/java/com/google/android/exoplayer2/testutil/StubExoPlayer.java
View file @
3d3c90b8
...
@@ -21,6 +21,7 @@ import com.google.android.exoplayer2.BasePlayer;
...
@@ -21,6 +21,7 @@ import com.google.android.exoplayer2.BasePlayer;
import
com.google.android.exoplayer2.ExoPlaybackException
;
import
com.google.android.exoplayer2.ExoPlaybackException
;
import
com.google.android.exoplayer2.ExoPlayer
;
import
com.google.android.exoplayer2.ExoPlayer
;
import
com.google.android.exoplayer2.MediaItem
;
import
com.google.android.exoplayer2.MediaItem
;
import
com.google.android.exoplayer2.MediaMetadata
;
import
com.google.android.exoplayer2.PlaybackParameters
;
import
com.google.android.exoplayer2.PlaybackParameters
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.PlayerMessage
;
import
com.google.android.exoplayer2.PlayerMessage
;
...
@@ -357,6 +358,11 @@ public class StubExoPlayer extends BasePlayer implements ExoPlayer {
...
@@ -357,6 +358,11 @@ public class StubExoPlayer extends BasePlayer implements ExoPlayer {
}
}
@Override
@Override
public
MediaMetadata
getMediaMetadata
()
{
throw
new
UnsupportedOperationException
();
}
@Override
public
Timeline
getCurrentTimeline
()
{
public
Timeline
getCurrentTimeline
()
{
throw
new
UnsupportedOperationException
();
throw
new
UnsupportedOperationException
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment