【问题标题】:how to call play, pause on vlcplugin in mozilla firefox如何在 Mozilla Firefox 中调用播放、暂停 vlcplugin
【发布时间】:2012-05-02 14:42:03
【问题描述】:

在html页面中,我可以像videolan page中提到的那样嵌入vlcplugin,并使用jquery获取插件的引用。

但似乎只有vlcplugin0.8.5 支持play(), pause() 方法。如何播放和暂停最新版本的插件?

<embed id="vlcp"
  type="application/x-vlc-plugin" 
  pluginspage="http://www.videolan.org"
  name="VLC"
  autoplay="no"
  loop="no"
  volume="100"
  width="640"
  height="480" 
  target="test.flv">
</embed>
<a id="playbutton" href="#">Play</a>
<a id="pausebutton" href="#">Pause</a>

我可以参考下面的插件

var player = document.getElementById("vlcp");

现在,我应该调用什么来让嵌入式插件播放剪辑?

我使用firefox作为浏览器,在html中嵌入vlcplugin是否可以在chrome中工作?

【问题讨论】:

    标签: firefox vlc browser-plugin


    【解决方案1】:

    您必须使用您的 VLC 播放器的播放列表对象,如 here 所示。

    在您的特定示例中,您并没有真正创建实际的播放列表,而是隐含地向其中添加了一项(您的“test.flv”)。

    您现在可以通过以下方式控制电影(无论是 Mozilla、Chrome 还是 IE)-CoffeeScript 中的代码:

    player = document.getElementById("vlcp")
    if player and player.playlist
      // you could also check whether the playlist isn't empty using
      // player.playlist.items.count
      playlist = player.playlist
    
      // pick whichever action you need from below
      playlist.play()
      playlist.togglePause()
      playlist.stop()
    

    您还可以通过使用检查播放器当前是否正在播放或暂停/停止

    // assuming you got the playlist like above
    playlist.isPlaying
    

    【讨论】:

      【解决方案2】:

      这是一个演示示例:

      <html>
      <head><title>Demo of VLC mozilla plugin</title></head>
      
      <body>
      
      <h1>Demo of VLC mozilla plugin - Example 1</h1>
      
      <embed type="application/x-vlc-plugin"
               name="video1"
               autoplay="no" loop="yes" width="400" height="300"
               target="http://server.example.org/video1.vob" />
      <br />
        <a href="javascript:;" onclick='document.video1.play()'>Play video1</a>
        <a href="javascript:;" onclick='document.video1.pause()'>Pause video1</a>
        <a href="javascript:;" onclick='document.video1.stop()'>Stop video1</a>
        <a href="javascript:;" onclick='document.video1.fullscreen()'>Fullscreen</a>
      
      </body>
      </html>
      

      其他有用的资源/链接:

      http://www.videolan.org/doc/play-howto/en/ch04.html

      http://www.w3.org/2010/05/video/mediaevents.html

      【讨论】:

      • html sn-p 显示黑色矩形和链接..但不播放或暂停视频
      猜你喜欢
      • 2012-04-16
      • 1970-01-01
      • 2021-10-02
      • 1970-01-01
      • 1970-01-01
      • 2017-04-17
      • 2018-10-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多