Wrong volume control stream for CastPlayer in a Service
up vote
0
down vote
favorite
I'm using the ExoPlayer Google Cast extension v2.8.4. When playing content using the CastPlayer, the device's physical volume buttons should control the receiver device's volume. This behaves as expected when the CastPlayer is contained within an Activity. However, when the CastPlayer is contained within a Service (such as a MediaBrowserServiceCompat) the physical volume buttons change the sender device's media volume.
I've created 2 sample projects demonstrating the issue:
CastVolumeControlTest shows the proper volume control stream behavior while casting.
CastVolumeControlServiceTest shows the incorrect volume control stream behavior while casting.
As seen in the image below, the cast device volume does appear in the full volume controls view, but the phone's media volume is the active control stream when the CastPlayer is in a service.
Is there a way to set the proper volume control stream in the Service implementation?

add a comment |
up vote
0
down vote
favorite
I'm using the ExoPlayer Google Cast extension v2.8.4. When playing content using the CastPlayer, the device's physical volume buttons should control the receiver device's volume. This behaves as expected when the CastPlayer is contained within an Activity. However, when the CastPlayer is contained within a Service (such as a MediaBrowserServiceCompat) the physical volume buttons change the sender device's media volume.
I've created 2 sample projects demonstrating the issue:
CastVolumeControlTest shows the proper volume control stream behavior while casting.
CastVolumeControlServiceTest shows the incorrect volume control stream behavior while casting.
As seen in the image below, the cast device volume does appear in the full volume controls view, but the phone's media volume is the active control stream when the CastPlayer is in a service.
Is there a way to set the proper volume control stream in the Service implementation?

add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm using the ExoPlayer Google Cast extension v2.8.4. When playing content using the CastPlayer, the device's physical volume buttons should control the receiver device's volume. This behaves as expected when the CastPlayer is contained within an Activity. However, when the CastPlayer is contained within a Service (such as a MediaBrowserServiceCompat) the physical volume buttons change the sender device's media volume.
I've created 2 sample projects demonstrating the issue:
CastVolumeControlTest shows the proper volume control stream behavior while casting.
CastVolumeControlServiceTest shows the incorrect volume control stream behavior while casting.
As seen in the image below, the cast device volume does appear in the full volume controls view, but the phone's media volume is the active control stream when the CastPlayer is in a service.
Is there a way to set the proper volume control stream in the Service implementation?

I'm using the ExoPlayer Google Cast extension v2.8.4. When playing content using the CastPlayer, the device's physical volume buttons should control the receiver device's volume. This behaves as expected when the CastPlayer is contained within an Activity. However, when the CastPlayer is contained within a Service (such as a MediaBrowserServiceCompat) the physical volume buttons change the sender device's media volume.
I've created 2 sample projects demonstrating the issue:
CastVolumeControlTest shows the proper volume control stream behavior while casting.
CastVolumeControlServiceTest shows the incorrect volume control stream behavior while casting.
As seen in the image below, the cast device volume does appear in the full volume controls view, but the phone's media volume is the active control stream when the CastPlayer is in a service.
Is there a way to set the proper volume control stream in the Service implementation?

asked Nov 7 at 17:10
deRonbrown
551514
551514
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
I've determined the issue, and the cause is not due to a bug in ExoPlayer or the Cast extension. This commit in the CastVolumeControlServiceTest fixes the issue.
After debugging and looking through the device's logs, I discovered that the volume key events were directed to the active MediaSession. By setting the MediaSession to inactive, the volume control stream will control the receiver device, so the solution is the toggle MediaSession to active/inactive depending on which Player is current.
This didn't seem intuitive, but it works.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
I've determined the issue, and the cause is not due to a bug in ExoPlayer or the Cast extension. This commit in the CastVolumeControlServiceTest fixes the issue.
After debugging and looking through the device's logs, I discovered that the volume key events were directed to the active MediaSession. By setting the MediaSession to inactive, the volume control stream will control the receiver device, so the solution is the toggle MediaSession to active/inactive depending on which Player is current.
This didn't seem intuitive, but it works.
add a comment |
up vote
1
down vote
I've determined the issue, and the cause is not due to a bug in ExoPlayer or the Cast extension. This commit in the CastVolumeControlServiceTest fixes the issue.
After debugging and looking through the device's logs, I discovered that the volume key events were directed to the active MediaSession. By setting the MediaSession to inactive, the volume control stream will control the receiver device, so the solution is the toggle MediaSession to active/inactive depending on which Player is current.
This didn't seem intuitive, but it works.
add a comment |
up vote
1
down vote
up vote
1
down vote
I've determined the issue, and the cause is not due to a bug in ExoPlayer or the Cast extension. This commit in the CastVolumeControlServiceTest fixes the issue.
After debugging and looking through the device's logs, I discovered that the volume key events were directed to the active MediaSession. By setting the MediaSession to inactive, the volume control stream will control the receiver device, so the solution is the toggle MediaSession to active/inactive depending on which Player is current.
This didn't seem intuitive, but it works.
I've determined the issue, and the cause is not due to a bug in ExoPlayer or the Cast extension. This commit in the CastVolumeControlServiceTest fixes the issue.
After debugging and looking through the device's logs, I discovered that the volume key events were directed to the active MediaSession. By setting the MediaSession to inactive, the volume control stream will control the receiver device, so the solution is the toggle MediaSession to active/inactive depending on which Player is current.
This didn't seem intuitive, but it works.
answered Nov 9 at 16:13
deRonbrown
551514
551514
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53194439%2fwrong-volume-control-stream-for-castplayer-in-a-service%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown