VLC网页插件添加对火狐浏览器的支持
原文转自:http://blog.csdn.net/gsls200808/article/details/25536113
1.用<embed>标签
下面这段代码只支持火狐,不支持IE
<html> <title>VLC 测试</title> <body> <embed type="application/x-vlc-plugin" pluginspage="http://www.videolan.org" width="640" height="480" id="vlc"> </embed> <script language="Javascript"> var vlc = document.getElementById("vlc"); var mrl="rtsp://172.16.15.186:554/12345.sdp"; //将地址添加到播放列表 vlc.playlist.add(mrl); //播放 vlc.playlist.play(); </script> </body> </html>
2.同时支持IE和火狐的代码
通过测试发现,IE8.0并不支持js代码中VLC插件的接口,版本1和2都不支持,但是火狐浏览器支持
<html> <title>VLC 测试</title> <body> <!--将<embed>标签嵌入<object>标签内部之后可以同时兼容IE和火狐--> <object classid="clsid:E23FE9C6-778E-49D4-B537-38FCDE4887D8" codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab" width="640" height="480" events="True" id="vlc2"> <param name="MRL" value="udp://@239.255.1.1:1234" /> <param name="ShowDisplay" value="True" /> <param name="Loop" value="False" /> <param name="AutoPlay" value="True" /> <embed type="application/x-vlc-plugin" pluginspage="http://www.videolan.org" width="640" height="480" id="vlc"> </embed> </object> <script language="Javascript"> var vlc = document.getElementById("vlc"); var mrl="rtsp://172.16.15.186:554/12345.sdp"; //将地址添加到播放列表 vlc.playlist.add(mrl); //播放 vlc.playlist.play(); </script> </body> </html>
3.进一步精简的代码
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd"> <html> <head> <title>VLC 测试</title> </head> <body> <!--将<embed>标签嵌入<object>标签内部之后可以同时兼容IE和火狐--> <object classid="clsid:E23FE9C6-778E-49D4-B537-38FCDE4887D8" codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab" width="640" height="480" events="True" id="vlc2"> <param name="MRL" value="udp://@239.255.1.1:1234" /> <param name="ShowDisplay" value="True" /> <param name="Loop" value="False" /> <param name="AutoPlay" value="True" /> <embed type="application/x-vlc-plugin" pluginspage="http://www.videolan.org" width="640" height="480" src="rtsp://172.16.15.186:554/12345.sdp"; id="vlc"> </embed> </object> </body> </html>