【问题标题】:Embedded Vimeo Timestamp Link Not Working嵌入式 Vimeo 时间戳链接不起作用
【发布时间】:2020-08-18 09:06:25
【问题描述】:

我以前可以在我按下歌曲链接的地方让它工作,它会跳转到我的网站(Wordpress)中嵌入的 Vimeo 视频的时间。代码如下:

HTML

<div class="wpb_video_widget wpb_content_element vc_clearfix   vc_video-aspect-ratio-169 vc_video-el-width-100 vc_video-align-center">
<iframe id="player_1" src="https://player.vimeo.com/video/xxxxxxx?dnt=1&app_id=122963?api=1&player_id=player_1" width="1080" height="720" frameborder="0" allow="autoplay; fullscreen" allowfullscreen=""></iframe>
</div>
<div class="links">
<a class="link_1" href="javascript:void(0);" target="_self">Track 1 “Song Name”</a><br/>
<a class="link_2" href="javascript:void(0);" target="_self">Track 2 "Name of song"</a><br/>

JS 脚本

<script type="text/javascript">

// Set lesson times (in seconds)
var link_1_track = 000; 
var link_2_track = 323; 

// Function to hide all status messages
hidePlayNoticeAll = function() {
    jQuery(".link_1_status").html("");
    jQuery(".link_2_status").html("");

// Load Vimeo API for the embedded video
var iframe_player = jQuery('#player_1')[0];
var player_1 = $f(iframe_player);

// Function to control what happens when each lesson link is clicked
function setupLinks() {
        
    jQuery(".link_1").click(function () {
        player_1.api('play'); //Play the video
        player_1.api('seekTo', link_1_track); //Seek to the number of seconds in the variable link_1_track
        hidePlayNoticeAll(); // Hide all status messages before displaying (to prevent them from sticking) 
        jQuery(".link_1_status").html(playNotice); //Display status message (playNotice) within span with class link_1_status
    });
    
    jQuery(".link_2").click(function () {
        player_1.api('play');
        player_1.api('seekTo', link_2_track);
        hidePlayNoticeAll();
        jQuery(".link_2_status").html(playNotice);
    });
}

setupLinks();


</script>

代码有什么问题吗?还是我需要来自 vimeo 或 jquery 的 API?我不记得我之前做了什么让它工作。提前谢谢你。

【问题讨论】:

    标签: javascript jquery wordpress vimeo-player


    【解决方案1】:

    我已经找到了我需要的 API 来完成这项工作。所以我将结束我自己的问题哈哈。

    脚本使它像一个魅力,以防万一有人想使用该代码,这是下面的脚本。干杯。

    <script src="https://f.vimeocdn.com/js/froogaloop2.min.js"></script>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-12-10
      • 2013-02-01
      • 2014-08-13
      • 2020-06-17
      • 2022-01-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多