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

Cannot read property 'getRemotePlayer' of undefined #96

Open
anhminh10a2hoa opened this issue May 24, 2021 · 3 comments
Open

Cannot read property 'getRemotePlayer' of undefined #96

anhminh10a2hoa opened this issue May 24, 2021 · 3 comments

Comments

@anhminh10a2hoa
Copy link

ChromecastTech.js?ed59:48 Uncaught TypeError: Cannot read property 'getRemotePlayer' of undefined
at new constructor (ChromecastTech.js?ed59:48)
at Player.loadTech_ (video.es.js?f0e2:21766)
at Player.src_ (video.es.js?f0e2:24078)
at eval (video.es.js?f0e2:24025)
at setSourceHelper (video.es.js?f0e2:9744)
at eval (video.es.js?f0e2:9739)
at Object.setSource (videojs-contrib-ads.es.js?f9ad:748)
at setSourceHelper (video.es.js?f0e2:9728)
at setSourceHelper (video.es.js?f0e2:9746)
at Player.eval (video.es.js?f0e2:9485)

@damisparks
Copy link

@anhminh10a2hoa Did you manage to fix this ?
I am having the same issue.
image

@L1l1AnA
Copy link

L1l1AnA commented Nov 29, 2022

Did you manage to fix it? I'm having the same problem when changing the video in a single page app.
the code failing is this._remotePlayer = this._chromecastSessionManager.getRemotePlayer(); and it's caused because of a dispose of the player necessary to change the video and at the point this code is executed _chromecastSessionManager is undefined

@AlexGruzin
Copy link

Here is workaround that works for me:

  player.on('dispose', () => {
    const castSession = player.chromecastSessionManager?.getCastContext()?.getCurrentSession();
    if (castSession) castSession.endSession(true);
  })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants