1. Description
A recent project needs to embed IP camera footage into a Web page, taking into account the reduced development costs, using the VLC plugin to play the RTSP stream provided by the camera. The use of VLC Web plugin is described in detail on the website of the VideoLAN wiki.
One thing to note is that the previous version of Vlc2.2.0, the methods available on the wiki no longer apply. The reason is that there is no Axvlc.cab file in the last version of VLC, and the latest one is in the directory corresponding to version 0.9.2. And in IE it also responds that the CAB file is not signed and cannot install the plugin.
2. Workaround
Using the 2.2.0 later VLC version, the VLC plugin installation method can refer to the instructions on the vlc_help to install. Install VLC client under Windows and check the ActiveX plugin and Mozilla plugin.
The test procedure for writing the page is as follows:
<html><head><title>Web Camera Test</title><meta http-equiv="Content-type" content="text/html; Charset=utf-8 "></head><body bgcolor="White" text="Black"><embed type= "application/x-vlc-plugin" pluginspage="http// Www.videola.org "width=" 640 " height=" 480 " id=" VLC " version="videolan.vlcplugin.2" autoplay="yes" loop=" No " target=" Rtsp://user:[email protected]:554 " > </body></html>
If you want to determine whether the browser has VLC plugin installed, no plug-in jump to VLC download link, you can use the following JavaScript code (need to add an option to the body tag in HTML) onload="checkBrowser();"
. ):
<script type="Text/javascript"> //Only applicable to IE browser is, and install VLC plugin, then return true; function isinsalledievlc(){ varVlcobj =NULL;varVlcinstalled=false;Try{vlcobj =NewActiveXObject ("Videolan.vlcplugin.1");if(Vlcobj! =NULL) {vlcinstalled =true} }Catch(e) {vlcinstalled=false; }returnvlcinstalled; }//Only applicable to Firefox browser is, and install VLC plugin, then return true; function isinsalledffvlc(){ varNumplugins=navigator.plugins.length; for(i=0; i<numplugins;i++) {plugin=navigator.plugins[i];if(Plugin.name.indexOf ("VideoLAN") >-1|| Plugin.name.indexOf ("VLC") >-1){return true; } }return false; }/ * Browser detection * / function checkbrowser(){ varBrowser=navigator.appnamevarB_version=navigator.appversionvarversion=parsefloat(b_version)if(browser=="Netscape"&& version>=4) {if(ISINSALLEDFFVLC ()) {Alert ("Installed VLC plugin"); }Else{Alert ("VLC plugin not installed"); location.href="HTTP://DOWNLOAD.VIDEOLAN.ORG/PUB/VIDEOLAN/VLC/2.2.1/"; } }Else if(browser==Microsoft Internet Explorer&& version>=4) {if(ISINSALLEDIEVLC ()) {Alert ("Installed VLC plugin"); }Else{Alert ("No VLC plugin installed, please install the plugin first"); location.href="HTTP://DOWNLOAD.VIDEOLAN.ORG/PUB/VIDEOLAN/VLC/2.2.1/"; } } }</script>
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Embed IP cameras into Web pages and Web pages to play RTSP streams with VLC plugin