Embedding VLC plugin on HTML page

前端 未结 4 1788
轻奢々
轻奢々 2021-02-04 20:55

I have a html file (getStream.html) that takes a stream from a certain url and show it. The code is the following:



        
4条回答
  •  渐次进展
    2021-02-04 21:40

    I found this piece of code somewhere in the web. Maybe it helps you and I give you an update so far I accomodated it for the same purpose... Maybe I don't.... who the futt knows... with all the nogodders and dobedders in here :-/

    function runVLC(target, stream)
    {
    var support=true
    var addr='rtsp://' + window.location.hostname + stream
    if ($.browser.msie){
    $(target).html('')
    }
    else if ($.browser.mozilla || $.browser.webkit){
    $(target).html('')
    }
    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%'}) */

    Greets

    Gee

    I reduce the whole crap now to:

    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('')
    }
    else if (navigator.userAgent.toLowerCase().indexOf("msie")==-1){
    target.append('
    ')
    }
    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() } } } } };

    Didn't get it to work in ie as well... 2b continued...

    Greets

    Gee

提交回复
热议问题