2014-02-21 54 views
0

我使用<embed>標記從服務器讀取視頻流,我需要在播放此視頻前設置海報圖像,但我不知道如何在<embed>中設置海報圖像。嵌入標記中的海報圖片

這是我的代碼:

<embed type="application/x-vlc-plugin" 
    name="video1" 
    autoplay="no" loop="yes" width="400" height="300" 
    target="http://10.1.0.1:8180/stream?ip=225.1.0.2&port=1234" /> 

回答

0

我真的很快爲你打了這個。應該完成工作。

<style> 
    embed { 
     display:none; 
    } 
    #myPosterImage { 
     width:100%; 
     height:100%; 
    } 
    #vidWrapper { 
     width:400px; 
     height:300px; 
    } 
</style> 

<div id="vidWrapper"> 
    <img src="poster.jpg" id="myPosterImage"/> 
    <embed type="application/x-vlc-plugin" 
     name="video1" 
     autoplay="no" loop="yes" width="400" height="300" 
     target="http://10.1.0.1:8180/stream?ip=225.1.0.2&port=1234" /> 
</div> 


/* import jQuery at top in <head> and at bottom of page have this: */ 
<script> 
    $(function() { 
     $('#myPosterImage').on('click', function() { 
      $('#myPosterImage').hide(); 
      $('embed').show(); 
     }); 
    }); 
</script> 
0

embed元素沒有一個海報屬性。視頻確實,但看起來你正在做的事情,視頻不會支持(無論如何)。在這種情況下,您可能需要在頂部使用img元素,在視頻開始播放時使用JS刪除元素。

0

這並不完全回答這個問題,但我建議http://code.google.com/p/fbvlc/wiki/FBVLC_API它VLC的插件的一個分支,其在IE和其他瀏覽器,其中作爲VLC需要不同的嵌入標籤的作品。

它也有更多有用的javascript事件