Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: "Failed to execute send on PresentationConnection", when Chromecast left idle. #2446

Closed
londonshliach opened this issue Mar 10, 2020 · 4 comments
Assignees
Labels
status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Milestone

Comments

@londonshliach
Copy link

Have you read the FAQ and checked for duplicate open issues?
Yes.

What version of Shaka Player are you using?
2.5.9

Can you reproduce the issue with our latest release version?
Yes.

Are you using the demo app or your own custom app?
Both.

What browser and OS are you using?
Chrome on Android, and Chromecast.

What are the manifest and license server URIs?
I used the Angel One Manifest on the Shaka demo page.
https://storage.googleapis.com/shaka-demo-assets/angel-one/dash.mpd

What did you do?

  1. I started playing a video on the Shaka demo page and Cast it to my Chromecast.
  2. I paused the video (before it ended).
  3. I turned my phone off and left it for 25 minutes.
  4. When I turned my phone on again, I was still on the Shaka Demo page, but I was not able to play the video. Nothing happened when I pushed the play button. But the player still showed that I was connected (when pressing the button).
  5. I connected my phone to my computer via USB and used Chrome Dev tools to inspect the tab.
  6. Every time I pressed the play button I got the following error:
Uncaught DOMException: Failed to execute 'send' on 'PresentationConnection': Presentation connection is disconnected.
    at Sa (https://www.gstatic.com/eureka/clank/80/cast_sender.js:72:2020)
    at W (https://www.gstatic.com/eureka/clank/80/cast_sender.js:79:1380)
    at V.f.Cc (https://www.gstatic.com/eureka/clank/80/cast_sender.js:89:299)
    at chrome.cast.c.Qa (https://www.gstatic.com/eureka/clank/80/cast_sender.js:64:372)
    at chrome.cast.c.sendMessage (https://www.gstatic.com/eureka/clank/80/cast_sender.js:64:236)
    at shaka.cast.CastSender.sendMessage_ (https://shaka-player-demo.appspot.com/lib/cast/cast_sender.js:658:11)
    at shaka.cast.CastSender.remoteCall_ (https://shaka-player-demo.appspot.com/lib/cast/cast_sender.js:448:8)
    at HTMLButtonElement.<anonymous> (https://shaka-player-demo.appspot.com/ui/play_button.js:63:20)
Sa @ cast_sender.js:72
W @ cast_sender.js:79
f.Cc @ cast_sender.js:89
chrome.cast.c.Qa @ cast_sender.js:64
chrome.cast.c.sendMessage @ cast_sender.js:64
shaka.cast.CastSender.sendMessage_ @ cast_sender.js:658
shaka.cast.CastSender.remoteCall_ @ cast_sender.js:448
(anonymous) @ play_button.js:63

What did you expect to happen?
I expected it to either play the video on my Chromecast device, or to show that it was disconnected and play the video on my phone.

What actually happened?
It showed that I was still connected, but it wouldn't play.

@joeyparrish
Copy link
Member

I'm working on repro with the nightly build right now. If I can't reproduce on the nightly build, I'll try again with v2.5.9.

@joeyparrish
Copy link
Member

joeyparrish commented Mar 10, 2020

Confirmed on the nightly build. I forgot to pause the video, but the error occurred anyway. My steps:

  1. Open the nightly build
  2. Start playback of our DASH live stream
  3. Cast it to the TV
  4. Background Chrome on Android and lock the phone
  5. Wait 25 10 minutes
  6. Unlock the phone and bring Chrome to the foreground

The UI doesn't respond to the giant play/pause button.

@joeyparrish joeyparrish added type: bug Something isn't working correctly and removed needs triage labels Mar 10, 2020
@joeyparrish
Copy link
Member

The stack trace looks much as described by @londonshliach. I see that on this line:

https://github.com/google/shaka-player/blob/09147b1273a1252d2f6c7e3858ee4fa43fd7e42b/lib/cast/cast_sender.js#L670-L673

the method throws an error on timeout rather than calling the error callback we gave it. The fact that it throws feels like a Chromecast SDK bug. But that doesn't explain why we're unable to recover.

@shaka-bot shaka-bot added this to the v2.6 milestone Mar 10, 2020
@joeyparrish
Copy link
Member

Good news, everyone!

I can reproduce the issue with only 10 minutes of lock time.

@joeyparrish joeyparrish self-assigned this Apr 9, 2020
joeyparrish added a commit that referenced this issue Apr 22, 2020
When a mobile device goes idle, the Cast connection can be terminated
without explicitly closing it.  When this happens, the Cast session is
unusable and throws exceptions.

This changes CastSender to correctly detect and recover from such a
problem by disconnecting explicitly and dispatching an Error to the
application.

This also fixes the disconnection process so that playback can be
correctly resumed on the local device.

Closes #2446

Backported to v2.5.x

Change-Id: I59f51a1e911199eee22693e7db4ab39855de0298
@shaka-project shaka-project locked and limited conversation to collaborators Jun 12, 2020
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Apr 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Projects
None yet
Development

No branches or pull requests

3 participants