如何向MediaElement.js发送播放/暂停信号 [英] How to send a play/pause signal to MediaElement.js

查看:97
本文介绍了如何向MediaElement.js发送播放/暂停信号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人知道如何通过jquery / java发送信号来阻止电影播放/暂停等等。







Does anyone know how to send a signal via jquery/java to stop the movie from playing/pausing etc..



<!DOCTYPE html>
<html>
<head>
  <title>Video.js | HTML5 Video Player</title>

  <!-- Chang URLs to wherever Video.js files will be hosted -->
  <link href="video-js.css" rel="stylesheet" type="text/css">
  <!-- video.js must be in the <head> for older IEs to work. -->
  <script src="video.js"></script>
  <script src="jquery-1.11.0.js"></script>

  <!-- Unless using the CDN hosted version, update the URL to the Flash SWF -->
  <script>
    //videojs.options.flash.swf = "video-js.swf";
    videojs.options.flash.swf = "Module1.swf";
  </script>
  
  <script>
    $(document).ready(function()
    {
      $("#Tester").mousedown(
      function()
      {   
        //What need to be placed here to cause the media to pause
      	//$("#example_video_1").media.pause();
        
        //new MediaElement(v, {success: function(media) {    media.pause();}});
        
      });
    });
  </script>


</head>
<body>

  <video id="example_video_1" class="video-js vjs-default-skin" controls preload="none" width="640" height="264"

      

      data-setup="{}">
    <source src="Module1.swf" type='video/flv' />
    <track kind="captions" src="demo.captions.vtt" srclang="en" label="English"></track><!-- Tracks need an ending tag thanks to IE9 -->
    <track kind="subtitles" src="demo.captions.vtt" srclang="en" label="English"></track><!-- Tracks need an ending tag thanks to IE9 -->
  </video>
  
  
  <div ID="Tester">
    Click This
  </div>

</body>
</html>

推荐答案

document )。ready( function ()
{
(document).ready(function() {


(< span class =code-string> #Tester)。mousedown(
functio n ()
{
// 需要放在这里需要什么暂停的媒体
//
("#Tester").mousedown( function() { //What need to be placed here to cause the media to pause //


( #example_video_1)。media.pause();

// new MediaElement(v,{success:function(media){media.pause();}});

});
});
< / script >


< / head >
< 正文 >

< video id = example_video_1 class = video-js vjs-default-skin 控件 preload = none width = 640 height = 264



data-setup = {} >
< source src = Module1.swf type =' video / flv' / >
< < span class =code-leadattribute> track kind = 标题 src = demo.captions.vtt srclang = zh-CN label = 英语 > < / track > <! - < span class =code-keyword> 由于IE9 - > <,因此曲目需要一个结束标记/ span>
< track kind = subti tles src = demo.captions.vtt srclang = zh 标签 = 英语 > < / track > <! - 曲目需要结束感谢IE9 - >
< / video >


< div ID = 测试人员 > ;
点击此
< / div >

< / body >
< / html >
("#example_video_1").media.pause(); //new MediaElement(v, {success: function(media) { media.pause();}}); }); }); </script> </head> <body> <video id="example_video_1" class="video-js vjs-default-skin" controls preload="none" width="640" height="264" data-setup="{}"> <source src="Module1.swf" type='video/flv' /> <track kind="captions" src="demo.captions.vtt" srclang="en" label="English"></track><!-- Tracks need an ending tag thanks to IE9 --> <track kind="subtitles" src="demo.captions.vtt" srclang="en" label="English"></track><!-- Tracks need an ending tag thanks to IE9 --> </video> <div ID="Tester"> Click This </div> </body> </html>


这篇关于如何向MediaElement.js发送播放/暂停信号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆