question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

onPlayerReady() not working for me on initialLoad in chrome

See original GitHub issue

onPlayerReady() is not working for me on the first load of my angular apps view. This use to work on my site 100% of the time on a published website. After a recent update from chrome (2018) the video no longer plays if you initiate the URL but if you start somewhere else on the website, the video plays fine. Not sure how to troubleshoot this because it use to work fine and now with a new chrome update its borked.

the URL is https://zadesigns.com/welcome

if you goto any other link on that site and then click my logo to goto the homepage the video plays fine. but if you start at the homepage onLoad the video does not play fine. its almost like some sort of timing issue? not sure if there was anything update in videogular and chrome that I missed that might affect it?

the code is as follows.

<vg-player (onPlayerReady)="onPlayerReady($event)" *ngIf="sources.length>0">
    <video #myWelcome [vgMedia]="myWelcome" [vgMaster]="true" id="singleVideo" preload="true" [controls]="controls" muted playsinline autoplay>
      <source *ngFor="let video of sources" [src]="video.src" [type]="video.type">
    </video>
  </vg-player>

The video is muted, plays inline, and also has no audio so it absolutely should meet the autoplay requierments (as it does when you navigate to the link from another section of the site). and of course, this works on firefox and safari and also chrome (when the inspector is open). but when the inspector in chrome is closed it fails.

the Typescript codes is like this

  onPlayerReady(api: VgAPI) {
    this.api = api;
    this.fsAPI = this.api.fsAPI;
    this.nativeFs = this.fsAPI.nativeFullscreen;
    this.api.getDefaultMedia().subscriptions.canPlay.subscribe(
      () => {
        this.api.play();
      }
    );

    this.api.getDefaultMedia().subscriptions.ended.subscribe(
      () => {
        this.state.go('app.about');
      }
    );
  }

I am using

"@angular": "^5.0.1",
"videogular2": "^5.6.3",

This site has been published for a little while so I haven’t been updating and maintaining angular’s version and videogular2 but like I had said it was working in every browser for ever until just recently when chrome stopped liking something that I am doing? any ideas? thanks!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
zuriecommented, Jul 13, 2018

I think its getting off topic, i’d say this bug is closed from my end, but if you wanted to get sound I believe you are required to have some user interaction, so youtube for example has a push to unmute button and it toggles the sound on, I am not 100% sure you can programmatically toggle sound on because chrome will throw an error without some form of user interaction.

0reactions
dnyaneshwar-surywanshicommented, Jul 25, 2019

@lshens Can u send me ur code of vg-player

Read more comments on GitHub >

github_iconTop Results From Across the Web

onPlayerReady() is not firing, player is only partially initialized
Try setting ' enablejsapi="1" ' both in the url and as and attribute of the iframe like this: <iframe id="video1" type="text/html" ...
Read more >
Fix videos & games that won't play - Google Chrome Help
If a YouTube video, Facebook game, or other media isn't working, try the steps below to fix it. These steps can help for:...
Read more >
Player API not functional when explicit iframe tag (without ...
Player() constructor with HTML is loaded from a file:// url the origin= parameter is not appended to the URL and the player still...
Read more >
Google Chrome - Websites Not Loading Fix - YouTube
For more information, follow this guide:https://www.techy.how/tutorials/google- chrome -site- not -loadingA short tutorial on how to fix the ...
Read more >
Youtube trigger isn't working in Google Tag Manager? 9 ways ...
Enable JavaScript API support to all embedded Youtube videos. The first thing you could do with the trigger if you're not seeing gtm.video ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found