Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
Revert of Enable MediaSession with the WMPI Cast player. (patchset #1
Browse files Browse the repository at this point in the history
…id:1 of https://codereview.chromium.org/1590863004/ )

Reason for revert:
Reverting since it's causing a MediaPlayer to be created along side the WebMediaPlayerImpl instance... which causes playback to start twice :-/

Original issue's description:
> Enable MediaSession with the WMPI Cast player.
>
> Looks like the cast impl didn't enable MediaSession when cast is
> not present.  Tweaked the code a bit so that it's available.
>
> BUG=575276,529887
> TEST=MediaSession play/pause work.
>
> Committed: https://crrev.com/0ae23b0efd1eb826fe3df2af5baa9415c828b593
> Cr-Commit-Position: refs/heads/master@{#369895}

[email protected]
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=575276,529887

Review URL: https://codereview.chromium.org/1615513003

Cr-Commit-Position: refs/heads/master@{#370624}
  • Loading branch information
dalecurtis authored and Commit bot committed Jan 21, 2016
1 parent b81f43d commit 6e2716d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
21 changes: 7 additions & 14 deletions media/blink/webmediaplayer_cast_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ void WebMediaPlayerCast::OnConnectedToRemoteDevice(
is_remote_ = true;
initializing_ = true;
paused_ = false;
if (delegate_ && is_remote_)
if (delegate_)
delegate_->DidPlay(webmediaplayer_);
client_->playbackStateChanged();

Expand All @@ -273,13 +273,11 @@ void WebMediaPlayerCast::play() {
player_manager_->Start(player_id_);
remote_time_at_ = base::TimeTicks::Now();
paused_ = false;
if (delegate_ && is_remote_)
if (delegate_)
delegate_->DidPlay(webmediaplayer_);
}

void WebMediaPlayerCast::pause() {
if (paused_)
return;
player_manager_->Pause(player_id_, true);
}

Expand All @@ -292,7 +290,7 @@ void WebMediaPlayerCast::OnDisconnectedFromRemoteDevice() {
DVLOG(1) << __FUNCTION__;
if (!paused_) {
paused_ = true;
if (delegate_ && is_remote_)
if (delegate_)
delegate_->DidPause(webmediaplayer_);
}
is_remote_ = false;
Expand All @@ -310,13 +308,10 @@ void WebMediaPlayerCast::OnDidExitFullscreen() {
void WebMediaPlayerCast::OnMediaPlayerPlay() {
DVLOG(1) << __FUNCTION__ << " is_remote_ = " << is_remote_;
initializing_ = false;
if (paused_) {
if (is_remote_ && paused_) {
paused_ = false;
if (delegate_ && paused_ && is_remote_)
if (paused_)
delegate_->DidPlay(webmediaplayer_);
if (!is_remote_)
webmediaplayer_->play();

remote_time_at_ = base::TimeTicks::Now();
client_->playbackStateChanged();
}
Expand All @@ -327,12 +322,10 @@ void WebMediaPlayerCast::OnMediaPlayerPlay() {

void WebMediaPlayerCast::OnMediaPlayerPause() {
DVLOG(1) << __FUNCTION__ << " is_remote_ = " << is_remote_;
if (!paused_) {
if (is_remote_ && !paused_) {
paused_ = true;
if (delegate_ && is_remote_)
if (delegate_)
delegate_->DidPause(webmediaplayer_);
if (!is_remote_)
webmediaplayer_->pause();
client_->playbackStateChanged();
}
}
Expand Down
4 changes: 2 additions & 2 deletions media/blink/webmediaplayer_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ void WebMediaPlayerImpl::play() {
DCHECK(main_task_runner_->BelongsToCurrentThread());

#if defined(OS_ANDROID) // WMPI_CAST
cast_impl_.play();
if (isRemote()) {
cast_impl_.play();
return;
}
#endif
Expand All @@ -344,8 +344,8 @@ void WebMediaPlayerImpl::pause() {
paused_ = true;

#if defined(OS_ANDROID) // WMPI_CAST
cast_impl_.pause();
if (isRemote()) {
cast_impl_.pause();
return;
}
#endif
Expand Down

0 comments on commit 6e2716d

Please sign in to comment.