0

I can't seem to get a Kaltura Player to stop playing the videos when I close a bootstrap modal. I have tried many different scripts that I've found online but none of them seem to work. Most of the scripts are for vimeo or youtube but I need to get one to work with Kaltura.

Any help is appreciated!! Here is my code:

Title

Paragraph

View Tutorial
    <!-- My Modal -->
    <div id="#myModal" class="modal fade" role="dialog">
        <div class="modal-dialog">

    <!-- My Modal Content-->
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">X</button>
                    <h4 class="modal-title">Title</h4>
            </div>
            <div class="modal-body">
              <div class="row">
                <div class="col-sm-12">
                  <div class="embed-responsive embed-responsive-16by9">
                      <iframe id="kmsembed-0_rzj5pqht" width="auto" height="auto" src="#" class="embed-responsive-item kmsembed" allowfullscreen webkitallowfullscreen mozAllowFullScreen frameborder="0"></iframe>
                  </div>
                </div>
              </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            </div>
        </div>
    <!-- /My Modal content -->
      </div>
    </div>
  <!-- /My Modal -->
4

2 回答 2

0

我知道这个问题有点老,但在寻找这个答案时我遇到了一个解决方案,并认为我会在这里发布它,以防其他人遇到这个问题。根据在此处找到的 Kaltura 站点文档,您可以使用destroy

示例代码:

$('#myModal').on( 'hide', function(){
    kWidget.destroy('kaltura_player');
});

'kaltura_player'用嵌入的视频替换文本ID。这适用于嵌入iframe.

于 2016-10-26T21:38:44.783 回答
0

您需要在模式关闭时触发暂停或停止。

引导程序 3

$('#myModal').on('hidden.bs.modal', function () {
    kdp.sendNotification("doPause");
})

引导程序 2.3.2

$('#myModal').on('hidden', function () {
    kdp.sendNotification("doPause");
})

或者如果以上方法不适合您,请尝试以下方法:

$('#myModal').on('hidden.bs.modal', function () {
    $('#kmsembed-0_rzj5pqht').attr('src', $('#kmsembed-0_rzj5pqht').attr('src'));
})
于 2015-08-12T20:28:56.817 回答