Muting an embedded vimeo video

前端 未结 12 2253
攒了一身酷
攒了一身酷 2020-12-14 07:42

On a website I am building I have a vimeo video embedded. The client needs to keep the sound on the video obviously for people that find it on vimeo. However for her website

12条回答
  •  情歌与酒
    2020-12-14 08:08

    Since most of the answers here are referring to Vimeo's old api. Here is the simplest way with the new api. You can include vimeo player.js from their CDN or you can download it or you can include it from npm.

    
    

    or

    npm install @vimeo/player

    then you can do the following.

        
    

    that's it. And if you are using angular 2+,

    import * as Vimeo from '@vimeo/player';
    
    const iframe = e.target;
    const player = new Vimeo(iframe);
    player.setVolume(0);
    

    here e.target is $event which would be passed from the template. Probably it could be iframe (load) event. Or may be you can use jquery to select iframe.

提交回复
热议问题