On iPhone, Vimeo Javascript API .play() function doesn't work until the video has been played

前端 未结 3 1961
死守一世寂寞
死守一世寂寞 2021-01-05 14:50

I\'m using SwipeView (http://cubiq.org/swipeview) to create a swipeable slideshow on touchscreen devices. This is simple enough with images, but I want to include a Vimeo vi

3条回答
  •  旧巷少年郎
    2021-01-05 15:25

    Some browser forbid to trigger the "play" via js in the beginning. There has to be real user interaction to play the video.

    However, if you want to put the vimeo video in a slider what you can do is:

    1. apply a image with "play button" on top of the video
    2. set "opacity: 0" to the iframe and make it exactly the size&position of the "play button" (iframe have to be "allowfullscreen")
    3. once user trigger the video play for the first time. Make the iframe to normal size you want and let vimeo player.js take control.

    In this case, user have to click the "play button" to trigger the video

提交回复
热议问题