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

H5自动播放避坑 #10

Open
gou-tian opened this issue Jun 26, 2017 · 0 comments
Open

H5自动播放避坑 #10

gou-tian opened this issue Jun 26, 2017 · 0 comments

Comments

@gou-tian
Copy link
Owner

gou-tian commented Jun 26, 2017

自动播放问题

视频的自动播放需要在video标签上添加autoplay属性

<video autoplay><video/>

但是在很多浏览器里,如iOS下并不支持这个属性,在iOS下必须给webview设置

self.wView.allowsInlineMediaPlayback = YES;
self.wView.mediaPlaybackRequiresUserAction = NO;

如果需要在h5页面内播放视频,需要在视频标签上加上 webkit-playsinline,在iOS10以后,需要加上playsinline,建议同时加上这两个属性

<video id="player" webkit-playsinline playsinline >

app内置属性

webview.allowsInlineMediaPlayback = YES;
@gou-tian gou-tian changed the title H5避坑指南 H5自动播放避坑 Jun 26, 2017
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

1 participant