onPlayerReady() not working for me on initialLoad in chrome
See original GitHub issueonPlayerReady() 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:
- Created 5 years ago
- Comments:8 (2 by maintainers)
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.
@lshens Can u send me ur code of vg-player