I can't autoplay vimeo video (mobile)

僤鯓⒐⒋嵵緔 提交于 2020-01-03 04:10:07

问题


I'm trying to autoplay a video included in a iframe on mobile devices.

The app works well, but the user must click on the button inside the iFrame to play the video.

I already tried to use the "autoplay=1" parameter in the iframe but it didn't word on mobile (on desktop well)...

Can you help me?

Thanks


回答1:


As @A.Wolff remarks, autoplay is disabled by design to preserve bandwidth.

It's, for instance, possible to "trick" iOS into thinking that the user clicked the play button (Google it, if you want to know how).

However, Vimeo would have to implement this since you won't be able to manipulate the contents of an iframe from an external source.

Conclusion: You can't autoplay an embeded Vimeo video on mobile devices.

(For the curious, I did some digging in the source of the embed player via remote debugging in Safari and wasn't able to find a way to get the video to play without tapping the play button)




回答2:


https://vimeo.com/help/faq/mobile/mobile-videos#why-cant-i-loop-or-autoplay-my-videos-on-mobile-devices

The link above clearly states that Vimeo won't support mobile autoplay feature. Try using YouTube or BrightCove and I'm certain they do.

  • AJ



回答3:


I tried Vimeo iframe player with iOS 11 and autoplay parameter works well. Only problem is with playing video inline. It seems not possible (at least I couldn't do it).

I tried it also with android (SDK 19 - Android 4.4 and above). Autoplay param doesn't work here for me but I am able to autoplay videos with little workaround:

player.loadVideo(videoId).then(function(id)
{
    player.play()
    player.pause()
    setTimeout(function() { player.play() }, 750)
})

The player have to be initialized with random video, for example:

player = new Vimeo.Player('player', {
    id: 59777392,
    //autoplay: 1 // only for iOS, it is not necessary on Android
})

and after player.ready() method is fired you can call loadVideo(videoId) like I showed above.



来源:https://stackoverflow.com/questions/20613365/i-cant-autoplay-vimeo-video-mobile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!