Wistia:通过特定网址打开模态而不玩

时间:2017-05-15 18:39:26

标签: javascript wistia

在我们的主页上,我们有一个以模态打开的Wistia嵌入,并在用户单击文本链接时播放。我想创建一个特殊的网址,我可以发送给他们自动打开模态但不会开始播放。

HTML:

<span class="wistia_embed wistia_async_i74bcbgfkm popover=true popoverAnimateThumbnail=true popoverContent=link wistia_embed_initialized" style="display:inline" id="wistia-i74bcbgfkm-1">
  <div id="wistia_36.thumb_container" class="wistia_click_to_play" style="position: relative; display: inline;">
    <a class="text-link" href="#">See the science. Watch video.</a>
  </div>
</span>

JS:

// Auto Play Wistia Video via Specific Link

$(document).ready(function() {

  if(window.location.href.indexOf('#science') != -1) {
    ## open modal?
  }

});

这可能吗?

1 个答案:

答案 0 :(得分:1)

偶然发现了同样的问题,以及我如何修复它:

⚠️小心不要总是使用相同的Wistia视频ID。

<script src="https://fast.wistia.com/embed/medias/m1h6asljqh.jsonp"></script>
<script src="https://fast.wistia.com/assets/external/E-v1.js"></script>
<span class="wistia_embed wistia_async_m1h6asljqh popover=true popoverContent=link" style="display:inline">
  <a href="#" class="">What is Marker.io?</a>
</span>

<script>
    window._wq = window._wq || [];

    _wq.push({ id: "m1h6asljqh", onReady: function(video) {

      var video = Wistia.api("m1h6asljqh");

      if(window.location.href.indexOf('#showvideo') != -1) {
        video.popover.show(); // open the popover
        video.play(); // play the video
      }
    }});
</script>

让我知道它是否有帮助!

干杯