html页面上使用vlc,在HTML页面上嵌入VLC插件
我發現這段代碼在網絡的某個地方。 也許它可以幫助你,我為你提供了一個更新,目的是為了達到同樣的目的......也許我不......那些人知道......與所有的nogodders和dobedders在這里: -/
function runVLC(target, stream)
{
var support=true
var addr='rtsp://' + window.location.hostname + stream
if ($.browser.msie){
$(target).html('
"VideoLAN.VLCPlugin.2"' + 'classid = "clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921"' +
'events = "true"' + 'id = "vlc">
')}
else if ($.browser.mozilla || $.browser.webkit){
$(target).html('
'pluginspage="http://www.videolan.org"' + 'version="VideoLAN.VLCPlugin.2" ' +
'width="660" height="372"' +
'id="vlc"' + 'autoplay="true"' + 'allowfullscreen="false"' + 'windowless="true"' +
'mute="false"' + 'loop="true"' + '
'branding="false"' + 'controls="false"' + 'aspectRatio="16:9"' +
'target="whatever.mp4">
')}
else{
support=false
$(target).empty().html('
Error: browser not supported! ')}
if (support){
var vlc = document.getElementById('vlc')
if (vlc){
var opt = new Array(':network-caching=300')
try{
var id = vlc.playlist.add(addr, '', opt)
vlc.playlist.playItem(id)
}
catch (e){
$(target).empty().html('
Error: ' + e + 'URL: ' + addr +
'
')}
}
}
}
/* $(target + ' object').css({'width': '100%', 'height': '100%'}) */
電賀
嘖嘖
我現在降低整個廢話:
function runvlc(){
var target=$('body')
var error=$('#dialog_error')
var support=true
var addr='rtsp://../html/media/video/TESTCARD.MP4'
if (navigator.userAgent.toLowerCase().indexOf("msie")!=-1){
target.append('
VideoLAN.VLCPlugin.2"' + 'classid = "clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921"' +
'events = "true"' + 'id = "vlc">
')}
else if (navigator.userAgent.toLowerCase().indexOf("msie")==-1){
target.append('
'pluginspage="http://www.videolan.org"' + 'version="VideoLAN.VLCPlugin.2" ' +
'width="660" height="372"' +
'id="vlc"' + 'autoplay="true"' + 'allowfullscreen="false"' + 'windowless="true"' +
'mute="false"' + 'loop="true"' + '
'branding="false"' +
'controls="false"' + 'aspectRatio="16:9"' + 'target="whatever.mp4">
')}
else{
support=false
error.empty().html('Error: browser not supported!')
error.show()
if (support){
var vlc=document.getElementById('vlc')
if (vlc){
var options=new Array(':network-caching=300') /* set additional vlc--options */
try{ /* error handling */
var id = vlc.playlist.add(addr,'',options)
vlc.playlist.playItem(id)
}
catch (e){
error.empty().html('Error: ' + e + '
URL: ' + addr + '')
error.show()
}
}
}
}
};
沒有得到它的工作in ie以及... 2b續...
Greets
嘖嘖
總結
以上是生活随笔為你收集整理的html页面上使用vlc,在HTML页面上嵌入VLC插件的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [ kvm ] 学习笔记 1:Linux
- 下一篇: 2017年html5行业报告,云适配发布