jQuery 如何隐藏 Vimeo 控件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24971297/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 02:43:07  来源:igfitidea点击:

How to Hide Vimeo Controls

jqueryvimeovimeo-api

提问by Tairoc

Our students are provided with video tutorials using Vimeo.

我们为学生提供了使用 Vimeo 的视频教程。

Once a student was done with watching the videos, s/he is presented with some quizzes.

学生看完视频后,会向他/她展示一些测验。

What we discovered was that the students would use fast Forward control to move the slider forward to shorten the time it takes to watch the videos.

我们发现学生会使用快进控制来向前移动滑块以缩短观看视频的时间。

We want to stop that and we are wondering if there is a way to either disable or hide the fast Forward control so students are no longer able to move forward to shorten the video time.

我们想停止这种情况,我们想知道是否有办法禁用或隐藏快进控制,以便学生不再能够向前移动以缩短视频时间。

Thanks for your help

谢谢你的帮助

回答by Dan

  1. Make sure you are logged into Vimeo.

  2. Go to the video settings page: https://vimeo.com/{enter_video_id}/settings/embed

  3. Uncheck Show Play Barunder Player Preferences

  1. 确保您已登录 Vimeo。

  2. 进入视频设置页面: https://vimeo.com/{enter_video_id}/settings/embed

  3. 取消选中Show Play BarPlayer Preferences

enter image description here

在此处输入图片说明

Edit: You must have a Plus or Pro account to use these features.

编辑:您必须拥有 Plus 或 Pro 帐户才能使用这些功能。

回答by Antu R.

We can control all things in iframe see EX.

我们可以控制iframe中的所有东西见EX。

title=0   for title hide
sidedock=0  for social icon hide
controls=0 . for button hide

<iframe class="iframe" src="//player.vimeo.com/video/191777290?title=0&byline=0&portrait=0&sidedock=0" width="100%" height="430" frameborder="0" webkitallowfullscreen   mozallowfullscreen allowfullscreen>

回答by Adam Kozlowski

This is my solution to prevent Vimeo fast forward - I made interaction with Vimeo API that is really brilliant.

这是我防止 Vimeo 快进的解决方案 - 我与 Vimeo API 进行了非常出色的交互。

Script remembers the moment of the video where user try to fast forward. Then js will go back to right place.

脚本会记住用户尝试快进的视频时刻。然后js会回到正确的地方。

Your video:

你的视频:

<iframe src="{{ $video_path }}" width="100%" height="500px" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>

Remember to add vimeo script:

记得添加 vimeo 脚本:

<script src="https://player.vimeo.com/api/player.js"></script>

JavaScript logic:

JavaScript 逻辑:

 let iframe = document.querySelector('iframe');
 let player = new Vimeo.Player(iframe);
 let playing = false;
 let simulationTime = 0;

 player.on('play', function(e) {
     playing = true;
 });

 player.on('pause', function(e) {
     playing = false;
 });

 /**
 * Event fired when user want to fast forward
 */
 player.on('seeked', function(e) {
     if (e.seconds > simulationTime) {
         player.setCurrentTime(simulationTime).then(function(seconds) {
         }).catch(function(error) {
            switch (error.name) {
                case 'RangeError':
                    // The time is less than 0 or greater than the video's duration
                    break;
                default:
                    // Some other error occurred
                    break;
            }
         });
     }
     else {
         simulationTime = data.seconds;
     }
 });

 /**
 * Keep time going
 */
 window.setInterval(function() {
     if (playing) {
         simulationTime++;
     }
 }, 1000);

Cheers!

干杯!