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

how to resolve the problem that Chrome 66 turning off autoplay released in April 2018 #40

Closed
zhangzs000 opened this issue Aug 2, 2018 · 12 comments

Comments

@zhangzs000
Copy link

zhangzs000 commented Aug 2, 2018

when i new a xgplayer instance that has a config autoplay: true, but it not auto at chrome.
so i switch the browsers to use firefox. it works.
how to resolve this problem
after i use the play method referencing api documents
player.play()
then chrome has a error:
Uncaught (in promise) DOMException: play() failed because the user didn't interact with the document first

@zhangxin92
Copy link
Contributor

zhangxin92 commented Aug 2, 2018

In Chrome, muted autoplay is always allowed. See the policy. So autoplay is available in xgplayer with config "volume: 0".

@zhangxin92
Copy link
Contributor

Another article.

@zhangzs000
Copy link
Author

zhangzs000 commented Aug 4, 2018

In my project my video still cant auto play at chrome 68.0.3440.84 on macOS High Sierra, i suspect It be effected the warning message:

Failed to load http://img-test.aixuexi.com/B:1005:K/1532448000/0caeb04be45a4447b9896015eb1bf02c.mp4: Request header field Range is not allowed by Access-Control-Allow-Headers in preflight response.

i add the config: ### crossOrigin: true
it still has warning.
i dont know why?

official demo can auto play. it url: http://h5player.bytedance.com/examples/

@zhangxin92
Copy link
Contributor

@zhangzs000 If you are trying to use xgplayer with xgplayer-mp4 plugin, your video server should support range request. With range request, the warning will not happen again.
The config "crossOrigin: true" is unnecessary.

@zhangzs000
Copy link
Author

operating environment:

mac
chrome 68.0.3440.84(正式版本) (64 位)

i remove the the plugin xgplayer-mp4, no warning "Request header field Range is not allowed by Access-Control-Allow-Headers in preflight response." in chrome now. but it still cant auto play.

so i suspect the reason is asynchronous request then i change the ajax to synchronization,It still cant auto play.

now i dont know why it cant auto play on chrome?

i use xgplayer "version": "1.0.5" in vue project

@zhangxin92
Copy link
Contributor

@zhangzs000 Did you config "volume: 0"?

@zhangzs000
Copy link
Author

zhangzs000 commented Aug 7, 2018

it can auto play on firefox and 360 browser,but in chrom
config volume: 0 also didnt work.
config muted: true, also didt work.

I am sad ..... T_T......PM demand it can autoplay on chrome.

@zhangxin92 zhangxin92 reopened this Aug 7, 2018
@zhangxin92
Copy link
Contributor

zhangxin92 commented Aug 8, 2018

Muted autoplay in Chrome is supported by a30892. You can try with the branch now or wait for v1.0.8 as soon as possible.

@zhangzs000
Copy link
Author

zhangzs000 commented Aug 8, 2018

wa, you are great. Why can official examples auto play in chrome?
official examples:
http://h5player.bytedance.com/examples/
but it cant autoplay in my project.

@zhangxin92
Copy link
Contributor

Chrome calculates MEI score for sites. policy autoplay When MEI is high enough, media playback without muted is allowed to autoplay on desktop only. Maybe the official site of xgplayer in your Chrome gets a high MEI.
The autoplay MEI computation method of Chrome is inexplicit for users, so we suggest that you should give up the plan that autoplay without muted.

@zhangxin92
Copy link
Contributor

zhangxin92 commented Aug 8, 2018

See your MEI in chrome://media-engagement/

@SuperChrisliu
Copy link

@zhangxin92 **Chrome calculates MEI score for sites. policy autoplay When MEI is high enough, media playback without muted is allowed to autoplay on desktop only.**
原来如此....

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

3 participants