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
d6442f63
authored
Aug 19, 2022
by
bachinger
Committed by
Marc Baechinger
Oct 19, 2022
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add device info to CastPlayer
Issue: androidx/media#142 PiperOrigin-RevId: 468666737
parent
4e7f9c57
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/CastPlayer.java
extensions/cast/src/test/java/com/google/android/exoplayer2/ext/cast/CastPlayerTest.java
extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/CastPlayer.java
View file @
d6442f63
...
...
@@ -80,6 +80,10 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
*/
public
final
class
CastPlayer
extends
BasePlayer
{
/** The {@link DeviceInfo} returned by {@link #getDeviceInfo() this player}. */
public
static
final
DeviceInfo
DEVICE_INFO
=
new
DeviceInfo
(
DeviceInfo
.
PLAYBACK_TYPE_REMOTE
,
/* minVolume= */
0
,
/* maxVolume= */
0
);
static
{
ExoPlayerLibraryInfo
.
registerModule
(
"goog.exo.cast"
);
}
...
...
@@ -727,10 +731,10 @@ public final class CastPlayer extends BasePlayer {
return
CueGroup
.
EMPTY_TIME_ZERO
;
}
/** This method
is not supported and always returns {@link DeviceInfo#UNKNOWN
}. */
/** This method
always returns {@link CastPlayer#DEVICE_INFO
}. */
@Override
public
DeviceInfo
getDeviceInfo
()
{
return
D
eviceInfo
.
UNKNOWN
;
return
D
EVICE_INFO
;
}
/** This method is not supported and always returns {@code 0}. */
...
...
extensions/cast/src/test/java/com/google/android/exoplayer2/ext/cast/CastPlayerTest.java
View file @
d6442f63
...
...
@@ -63,6 +63,7 @@ import static org.mockito.MockitoAnnotations.initMocks;
import
android.net.Uri
;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.DeviceInfo
;
import
com.google.android.exoplayer2.MediaItem
;
import
com.google.android.exoplayer2.MediaMetadata
;
import
com.google.android.exoplayer2.PlaybackParameters
;
...
...
@@ -1864,6 +1865,14 @@ public class CastPlayerTest {
verify
(
mockListener
,
never
()).
onMediaMetadataChanged
(
any
());
}
@Test
public
void
getDeviceInfo_returnsCorrectDeviceInfoWithPlaybackTypeRemote
()
{
DeviceInfo
deviceInfo
=
castPlayer
.
getDeviceInfo
();
assertThat
(
deviceInfo
).
isEqualTo
(
CastPlayer
.
DEVICE_INFO
);
assertThat
(
deviceInfo
.
playbackType
).
isEqualTo
(
DeviceInfo
.
PLAYBACK_TYPE_REMOTE
);
}
private
int
[]
createMediaQueueItemIds
(
int
numberOfIds
)
{
int
[]
mediaQueueItemIds
=
new
int
[
numberOfIds
];
for
(
int
i
=
0
;
i
<
numberOfIds
;
i
++)
{
...
...
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