如何在浏览器中播放不同类型的音视频文件? [英] how to play different types of audio-video files in the browser?

查看:175
本文介绍了如何在浏览器中播放不同类型的音视频文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户根据文件类型选择要播放的AV文件时,我想使用默认安装的媒体播放器播放它。


我想知道这是否是一个好方法 - 任何替代方案,建议或

改进?


if(wmv file)

document.write("< OBJECT id = Player

classid = CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6 height =" 354"

width =" 479">

< PARAM NAME =" autoStart" VALUE =" true">

< / OBJECT>

");


if(swf file)

document.write(" flash classid")

>
if(rm file)

document.write(" real audio classid")

Qs:

1)告诉你系统上安装了哪些播放器?

2)如何进行重入即可。让用户现在玩flash,然后在同一个浏览器中玩
,玩wmv等。

3)是否可以最小化或隐藏

没有玩?

4)如果玩家没有安装怎么办 - OBJECT标签是否会失败

优雅?


谢谢,

Anil

解决方案


一个******* @ gmail.com 写道:


用户根据文件类型选择要播放的AV文件,

我想使用默认安装的媒体播放器播放它。


我我想知道这是否是一个好方法 - 任何替代方案,建议或

改进?


if(wmv file)

文件.write("< OBJECT id = Player

classid = CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6 height =" 354"

width =" 479">

< PARAM NAME =" autoStart" VALUE =" true">

< / OBJECT>

");



以上和下面的2个对象使用ActiveX classid,因此这些

都是ActiveX对象。因此,它们不会在大多数非IE浏览器上工作。在许多情况下,您可以在IE和其他浏览器中使用普通对象,并避免使用无效的嵌入路径。


if(swf file)

document.write(" flash classid")

if(rm file)

document.write(" real audio classid")


Qs:

1)如何判断系统上安装了哪些播放器?



充其量是复杂的,如有更改,恕不另行通知玩家

升级。尽可能避免


2)如何制作可重入的ie。让用户现在玩flash,然后在同一浏览器中玩
,玩wmv等等。



我将在下面举例说明。 br />


3)是否可以最小化或隐藏未播放的玩家?



是的,下面是一个例子。


4)如果没有安装播放器怎么办 - 将OBJECT标签失败

优雅?



是的,如果代码写得正确 - 没有播放器=没有显示


请参阅我的页面 http://www.cwdjr.info/temp/video_multiFormat2.php 并且

一定要阅读源代码中的注释。该页面主要写入

流,用于高宽带连接。一个不会超过2Mbps支持
的连接将导致某些文件长时间缓冲。可以为高宽带,低宽带,

和拨号提供多种比特率。

请参阅 http://www.cwdjr.info/temp/video_multiBR3.php。对于

的例子。请注意,我正在使用播放列表文件,例如.wax

(对于WMP),。rpm对于Real玩家等。这些可以包含一个或多个

视频网址对网址的引用对于WMP,Real或其他玩家

可以播放的文件。 SMIL程序是针对Real播放器的,因为Real

内置了对大多数SMIL2的支持。其他一些玩家有非常有限的SMIL支持,所以你不希望这些SMIL文件被定向

。 .mov文件需要最复杂的对象,在这里我需要使用由Microsoft确定的ActiveX和对象路径

条件注释。


WMP最近出现了一个复杂问题,即每个使用此播放器嵌入

视频的人都应该注意。新的WMP11只能安装在Windows XP(可能是Vista)操作系统上,但是有很多这样的操作系统可能正在查看你的视频。如果

你嵌入了一个视频,并且对象中要求的视频宽度大于.wmv文件的实际宽度,则宽度为

延伸到代码中调用的宽度,但高度不在

非IE浏览器,包括最近的Opera,Firefox,Mozilla,Netscape和

Seamonkey。但是,在IE浏览器上查看图像是正常的。如果你有
有一个Windows XP操作系统,安装了新的WMP11,并打开了脚本,

你可以在
http://www.cwdjr.info/temp/video_multiFormat.php 。它将在IE上视为正常,并且在所提及的非IE浏览器上失真。希望

微软将纠正这个错误。在此之前,避免它的方法是

在目标代码中调用与

..wmv或其他视频文件的实际宽度相同的宽度。 WMP11。如果视频的实际宽度不是您的页面布局所需的,那么应该以所需的宽度重新编码视频

。如果你不注意上面的

并且有一个商业网站,那么游泳的苗条年轻女士的观众

穿着你希望出售的女士们可以将女士的宽度扩大到对于那些在非IE浏览器上使用WMP11的人来说,Henry VIII

,直到微软确认这个错误。


Hello cwdjrxyz,

感谢您的指示。

通过video_multiformat2源阅读,

我有以下困难:

< object data =" http://www.cwdjr.net/ram/realmix.rpm"

type =" audio /的X PN-的RealAudio-插件" ....


插件是从远程网址加载的。

有没有办法加载安装在本地的播放器
桌面而不是?

当从互联网断开连接时,用户仍然可以使用
播放AV文件。


谢谢,

Anil

12月25日晚上8:01,cwdjrxyz < spamtr ... @ cwdjr.infowrote:


anil.r ... @ gmail.com写道:


当用户选择要播放的AV文件时,根据文件类型,

我想使用默认安装的媒体播放器来播放它。


我想知道这是否是一个好方法 - 任何替代方案,建议或

改进?


if(wmv file)

document.write("< OBJECT id = Player

classid = CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6 height =" 354"

width =" 479">

< PARAM NAME =" autoStart" VALUE =" true">

< / OBJECT>

");上面和下面的2个对象使用ActiveX classid和因此这些



都是ActiveX对象。因此,它们不会在大多数非IE浏览器上工作。在许多情况下,您可以在IE和其他浏览器中使用普通对象,并避免使用无效的嵌入路径。


if(swf file)

document.write(" flash classid")


if (rm文件)

document.write(" real audio classid")


Qs:

1)如何判断系统上安装了哪些播放器?最多是复杂的,如有更改,恕不另行通知播放器



升级。尽可能避免


2)如何制作可重入的ie。让用户现在玩flash,然后在同一个浏览器中播放
,播放wmv等。我将在下面举例说明。


3)是否可以最小化或隐藏未播放的玩家?是的,一个例子如下。


4)如果没有安装播放器怎么办 - OBJECT标签是否会失败

优雅?是的,如果代码写得不错 - 没有玩家=没有显示



请参阅我的网页http://www.cwdjr.info/temp/video_multiFormat2.phpand

一定要阅读源代码中的注释。该页面主要写入

流,用于高宽带连接。一个不会超过2Mbps支持
的连接将导致某些文件长时间缓冲。可以为高宽带,低宽带,

和拨号提供多种比特率。

Seehttp://www.cwdjr.info/temp/video_multiBR3.php。对于

的例子。请注意,我正在使用播放列表文件,例如.wax

(对于WMP),。rpm对于Real玩家等。这些可以包含一个或多个

视频网址对网址的引用对于WMP,Real或其他玩家

可以播放的文件。 SMIL程序是针对Real播放器的,因为Real

内置了对大多数SMIL2的支持。其他一些玩家有非常有限的SMIL支持,所以你不希望这些SMIL文件被定向

。 .mov文件需要最复杂的对象,在这里我需要使用由Microsoft确定的ActiveX和对象路径

条件注释。


WMP最近出现了一个复杂问题,即每个使用此播放器嵌入

视频的人都应该注意。新的WMP11只能安装在Windows XP(可能是Vista)操作系统上,但是有很多这样的操作系统可能正在查看你的视频。如果

你嵌入了一个视频,并且对象中要求的视频宽度大于.wmv文件的实际宽度,则宽度为

延伸到代码中调用的宽度,但高度不在

非IE浏览器,包括最近的Opera,Firefox,Mozilla,Netscape和

Seamonkey。但是,在IE浏览器上查看图像是正常的。如果你有一个Windows XP操作系统,安装了新的WMP11,并打开了脚本,

你可以看到一个例子:http://www.cwdjr.info/temp /video_multiFormat.php。它将在IE上视为正常,并且在所提及的非IE浏览器上失真。希望

微软将纠正这个错误。在此之前,避免它的方法是

在目标代码中调用与WMP11播放的

.wmv或其他视频文件的实际宽度相同的宽度。如果视频的实际宽度不是您的页面布局所需的,那么应该以所需的宽度重新编码视频

。如果你不注意上面的

并且有一个商业网站,那么游泳的苗条年轻女士的观众

穿着你希望出售的女士们可以将女士的宽度扩大到对于那些在非IE浏览器上使用WMP11的人来说,Henry VIII

,直到微软确认这个bug为止。



***** **@gmail.com 写道:


Hello cwdjrxyz,

感谢您的指示。

通过video_multiformat2来源阅读,

我遇到以下问题:

< object data =" http://www.cwdjr.net/ram /realmix.rpm"

type =" audio / x-pn-realaudio-plugin" ....


插件是从远程网址加载的。

有没有办法加载安装在本地的播放器
桌面而不是?

当从互联网断开连接时,用户仍然可以播放AV文件



给定的mime类型的rpm只是一个标准类型的

Real播放列表文件。它指向存储实际媒体文件或文件

的位置。这只是标准程序,并确保

实际媒体文件被发送到真实播放器。真正的开发者网站

有更多关于Real的详细信息比大多数人想要知道的更多,

包括如果SMIL文件被指向它的Real将播放的SMIL。 br />

rpm文件是:
http://www.cwdjr.net/ram/realmix.smil


在这种情况下,它指向给定网址的SMIL文件。


如果您想在本地播放smill文件,只需将存储在其中的计算机上的本地

地址输入到Real Player中即可。

你长大了。 SMIL2文件是一种xml文件,在这个

的情况下是:


< smil xmlns =" http://www.w3 .org / 2001 / SMIL20 /语言">

< head>

< layout>

< root-layout width = " 500"高度= QUOT; 450"的backgroundColor = QUOT;蓝色" />

< region id =" video_region"的backgroundColor = QUOT;蓝色"的z-index = QUOT 1 QUOT; />

< regPoint id =" middle"左= QUOT; 50%"顶部= QUOT; 50%" regAlign = QUOT;中心" />

< region id =" brush_region_1"宽度= QUOT; 25%"高度= QUOT; 50%"左= QUOT; 0" top =" 0"

z-index =" 2" />

< region id =" brush_region_2"宽度= QUOT; 25%"高度= QUOT; 50%"左= QUOT; 25%" top =" 0"

z-index =" 2" />

< region id =" brush_region_3"宽度= QUOT; 25%"高度= QUOT; 50%"左= QUOT; 50%" top =" 0"

z-index =" 2" />

< region id =" brush_region_4"宽度= QUOT; 25%"高度= QUOT; 50%"左= QUOT; 75%" top =" 0"

z-index =" 2" />

< region id =" brush_region_5"宽度= QUOT; 25%"高度= QUOT; 50%"左= QUOT; 0" top =" 50%"

z-index =" 2" />

< region id =" brush_region_6"宽度= QUOT; 25%"高度= QUOT; 50%" left =" 25%"

top =" 50%"的z-index = QUOT; 2英寸/>

< region id =" brush_region_7"宽度= QUOT; 25%"高度= QUOT; 50%" left =" 50%"

top =" 50%"的z-index = QUOT; 2英寸/>

< region id =" brush_region_8"宽度= QUOT; 25%"高度= QUOT; 50%" left =" 75%"

top =" 50%"的z-index = QUOT; 2英寸/>

< / layout>

< transition id =" fromBlue"类型= QUOT; spiralWipe" subtype =" topLeftClockwise"

dur =" 5s" />

< transition id =" fromStar"类型= QUOT; starWipe"亚型= QUOT; fivePoint" dur =" 5s"

/>

< transition id =" fromKeyhole"类型= QUOT; miscShapeWipe" subtype =" keyhole"

dur =" 5s" />

< transition id =" fromHexagon"类型= QUOT; hexagonWipe" subtype =" vertical"

dur =" 5s" />

< transition id =" fromBarnZigZag" type =" barnZigZagWipe"

subtype =" vertical" DUR =" 10S" />

< transition id =" fromFourBox"类型= QUOT; fourBoxWipe" subtype =" cornersIn"

dur =" 10s" />

< transition id =" fromPinWheel"类型= QUOT; pinWheelWipe" subtype =" fourBlade"

dur =" 5s" />

< transition id =" fromSnake"类型= QUOT; snakeWipe" subtype =" topLeftHorizo​​ntal"

dur =" 10s" />

< transition id =" toBlue"类型= QUOT;褪色" subtype =" fadeToColor"

fadeColor =" blue" DUR =" 5S" />

< transition id =" toRed"类型= QUOT;褪色" subtype =" fadeToColor"

fadeColor =" red" DUR =" 5S" />

< transition id =" toGreen"类型= QUOT;褪色" subtype =" fadeToColor"

fadeColor =" green" DUR =" 5S" />

< transition id =" toYellow"类型= QUOT;褪色" subtype =" fadeToColor"

fadeColor =" yellow" DUR =" 5S" />

< / head>

< body>

< seq>

< img src =" chttp://www.cwdjr.net/ram/roach.gif" id =" image1"

region =" video_region" DUR =" 34S"宽度= QUOT; 256"高度= QUOT; 256" left =" 0"

top =" 0"填充= QUOT;定妆QUOT; title =" SMIL Bug"

< animate targetElement =" image1"的attributeName = QUOT;宽度" from =" 256"

to =" 128"开始= QUOT; 3S" DUR =" 4S"填充= QUOT;冻结" />

< animate targetElement =" image1"的attributeName = QUOT;高度" values =" 256; 128"

calcMode =" linear"开始= QUOT; 4S" DUR =" 4S"填充= QUOT;冻结" />

< animate targetElement =" image1"的attributeName = QUOT;左" to =" 196"

begin =" 9s" DUR =" 4S"填充= QUOT;冻结" />

< animate targetElement =" image1"的attributeName = QUOT;顶" to =" 196"

begin =" 14s" DUR =" 4S"填充= QUOT;冻结" />

< animateMotion targetElement =" image1"到= QUOT; -128,-128" begin =" 19s"

dur =" 4s"填充= QUOT;冻结" />

< set targetElement =" image1"的attributeName = QUOT;左"到= QUOT; 64" begin =" 24s"

fill =" freeze" />

< set targetElement =" image1"的attributeName = QUOT;顶"到= QUOT; 64" begin =" 24s"

fill =" freeze" />

< animate targetElement =" image1"的attributeName = QUOT;高度" to =" 256"

begin =" 26s" DUR =" 4S"填充= QUOT;冻结" />

< animate targetElement =" image1"的attributeName = QUOT;宽度" to =" 256"

begin =" 26s" DUR =" 4S"填充= QUOT;冻结" />

< animateMotion targetElement =" image1"到= QUOT; 0,0"开始= QUOT; 30秒" dur =" 4s"

fill =" freeze" />

< / img>

< / seq>

< seq>

< ; par>

< audio

src =" chttp://www.cwdjr.net/souopera/Tetrazzini_CaroNome_1911.rmj"

title =" Caro Nome RA"作者= QUOT; Tetrazzini" />

< img src =" chttp://www.cwdjr.net/picsnap/roscoe_foil2.jpg"

region =" video_region" regPoint = QUOT;中间" transIn =" fromBarnZigZag"

transOut =" toGreen"开始= QUOT; 2S"填充= [移除" DUR =" 240S"的z-index = QUOT; 3英寸/>

< / par>

< / seq>

<! - 从以下代码中删除评论标记玩midi。这里不包括
,因为Real可能会要求你安装Crescendo插件来玩
播放midi。 - >

<! -

< seq>

< par>

< ; audio src =" chttp://www.cwdjr.net/ram/cancan.mid" title =" Cancan mid" />

< img src =" chttp://www.cwdjr.net/picani/dancer_blacktights.gif"

region =" video_region" regPoint = QUOT;中间" transIn =" fromStar"

transOut =" toYellow"开始= QUOT; 2S"填充= [移除" DUR =" 120秒" />

< / par>

< / seq>

- >

< ; seq>

< par>

< audio src =" chttp://www.cwdjr.net/souearly/ColumbiaExpositionMarch.wma"

title =" Columbia Exposition March WMA"作者= QUOT; Sousa的" />

< img src =" chttp://www.cwdjr.net/picsnap/roscoe.jpg"

region =" video_region" regPoint = QUOT;中间" transIn =" fromFourBox"

transOut =" toYellow"开始= QUOT; 2S"填充= [移除" DUR =" 148S" />

< / par>

< / seq>

< seq>

< ; par>

< audio src =" chttp://www.cwdjr.net/ram/SidewalksOfNewYork.mp3"

title ="纽约人行道MP3" />

< img src =" chttp://www.cwdjr.net/pic3/burlesque_house2.jpg"

region =" video_region" regPoint = QUOT;中间" transIn =" fromSnake"

transOut =" toRed"开始= QUOT; 2S"填充= [移除" DUR =" 95S" />

< / par>

< / seq>

< seq>

< ; par>

< audio src =" chttp://www.cwdjr.net/ram/ZarahLeander.ram" title =" Zarah

Leander RA" />

< img src =" chttp://www.cwdjr.net/ram/aurora5f.jpg" region =" video_region"

regPoint =" middle" transIn = QUOT; fromStar" transOut = QUOT; toBlue" begin =" 2s"

fill =" remove" DUR =" 158S" />

< / par>

< / seq>

< seq>

< ; video src =" chttp://www.cwdjr.net/ram/eyeslicesmall.ram"

region =" video_region" regPoint = QUOT;中间" title =" eye slice - RM"

transIn =" fromPinWheel" transOut = QUOT; toRed"开始= QUOT; 2S" fill =" remove"

dur =" 70s" />

< / seq>

< seq>

< video src =" chttp://www.cwdjr .net / ram / pianopullsmall.ram"

region =" video_region" regPoint = QUOT;中间" title =" piano pull - RM"
< fromHexagon" transOut = QUOT; toRed"开始= QUOT; 2S" fill =" remove"

dur =" 119s" />

< / seq>

< seq>

< video src =" chttp://www.cwdjr .net / ram / Nosferatu.rmvb"

region =" video_region" regPoint = QUOT;中间" title =" Nosferatu - RM"

transIn =" fromStar" transOut = QUOT; toRed"开始= QUOT; 2S"填充= [移除" dur =" 175s"

/>

< / seq>

< seq>

< par>

< video src =" chttp://www.cwdjr.net/ram/caligari.rmvb"

region =" video_region" regPoint = QUOT;中间" title =" Caligari博士的内阁 -

RM"开始= QUOT; 4S" />

< brush color =" teal"区域= QUOT; brush_region_1"开始= QUOT; 0"端= QUOT; 7S" />

< brush color =" fuchsia"区域= QUOT; brush_region_2"开始= QUOT; 0.5秒"端= QUOT; 787-9" />

< brush color =" olive"区域= QUOT; brush_region_3"开始= QUOT; 1S"端= QUOT; 5S" />

< brush color =" red"区域= QUOT; brush_region_4"开始= QUOT; 1.5秒"端= QUOT; 11S" />

< brush color =" purple"区域= QUOT; brush_region_5"开始= QUOT; 2S"端= QUOT; 12S" />

< brush color =" blue"区域= QUOT; brush_region_6"开始= QUOT; 2.5S"端= QUOT; 787-8" />

< brush color =" maroon"区域= QUOT; brush_region_7"开始= QUOT; 3S"端= QUOT; 10S" />

< brush color =" navy"区域= QUOT; brush_region_8"开始= QUOT; 3.5s的"端= QUOT; 6S" />

< / par>

< / seq>

< seq>

< ; par>

< audio src =" chttp://www.cwdjr.net/ram/donkey.wav" title =" donkey wav"

begin =" 7s" />

< img src =" chttp://www.cwdjr.net/pic/horse_fanny3.jpg"

region =" video_region" regPoint = QUOT;中间" transIn =" fromBlue"

transOut =" toRed"开始= QUOT; 2S"填充= [移除" DUR =" 15S" />

< / par>

< / seq>

< / body>

< / smil>

当然,如果您想要离线,您还必须将图像文件指向您在计算机上存储这些文件的位置。当你玩

媒体时。


所有这些媒体都是为

网站上的渐进式下载流而设计的。当然,您可以将所有媒体文件存储在与SMIL文件相同的

目录中,并使用相对网址使其更简单

离线播放。但是,我并不想复制我已经存储在

服务器上各个位置的很长的

媒体文件。


When the user chooses an AV file to play, based upon the type of file,
I want to use the default installed media player to play it.

I am wondering if this is a good way - any alternatives, suggestions or
improvements?

if( wmv file)
document.write("<OBJECT id=Player
classid=CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6 height="354"
width="479">
<PARAM NAME="autoStart" VALUE="true">
</OBJECT>
");

if( swf file)
document.write("flash classid")

if(rm file)
document.write("real audio classid")
Qs:
1) How to tell which players are installed on the system?
2) How to make reentrant ie. let user play flash now, then afterwards
in the same browser, play wmv etc.
3) Is it possible to minimise or make invisible the players that are
not being played?
4) what if a player is not installed - will the OBJECT tag fail
gracefully?

thanks,
Anil

解决方案


an*******@gmail.com wrote:

When the user chooses an AV file to play, based upon the type of file,
I want to use the default installed media player to play it.

I am wondering if this is a good way - any alternatives, suggestions or
improvements?

if( wmv file)
document.write("<OBJECT id=Player
classid=CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6 height="354"
width="479">
<PARAM NAME="autoStart" VALUE="true">
</OBJECT>
");

The above and the 2 objects below use an ActiveX classid and thus these
are all thus ActiveX objects. Thus they will not work on most non-IE
browsers as written. In many cases you can use an ordinary object for
both IE and other browsers and avoid invalid embed paths for other
browsers.

if( swf file)
document.write("flash classid")

if(rm file)
document.write("real audio classid")
Qs:
1) How to tell which players are installed on the system?

Complicated at best, and subject to change without notice on player
upgrades. Avoid when possible

2) How to make reentrant ie. let user play flash now, then afterwards
in the same browser, play wmv etc.

I will give you an example below.

3) Is it possible to minimise or make invisible the players that are
not being played?

Yes, an example follows below.

4) what if a player is not installed - will the OBJECT tag fail
gracefully?

Yes, if the code is properly written - no player = no display

See my page at http://www.cwdjr.info/temp/video_multiFormat2.php and be
sure to read the comments in the source. The page is written mainly to
stream for a high broadband connection. A connection that will not
support over 2Mbps will cause long buffering on some files. It is
possible to offer multiple bitrates for high broadband, low, broadband,
and dialup. See http://www.cwdjr.info/temp/video_multiBR3.php . for an
example of this. Notice that I am using playlist files such as .wax
(for WMP), .rpm for Real players etc. These can contain one or more
video url references to urls for files that WMP, Real, or other player
can play. The SMIL program is directed to the Real player, because Real
has builtin support for most of SMIL2. Some other players have very
limited SMIL support, so you don''t want the SMIL file getting directed
to these. The .mov file required the most complex object, and here I
had to use both ActiveX and object paths as determined by Microsoft
conditional comments.

There is a recent complication for the WMP that everyone who embeds
videos using this player should be aware of. The new WMP11 can be
installed only on Windows XP(and likely Vista) OSs, but there are a
huge number of such OSs out there that may be viewing your videos. If
you embed a video and the width of the video called for in the object
is greater than the actual width for a .wmv file, the width is
stretched to the width called for in the code, but the height is not on
non-IE browsers including recent Opera, Firefox, Mozilla, Netscape, and
Seamonkey. However the image is normal viewed on an IE browser. If you
have a Windows XP OS, the new WMP11 installed, and script turned on,
you can see an example at
http://www.cwdjr.info/temp/video_multiFormat.php. It will view as
normal on IE and distorted on the mentioned non-IE browsers. Hopefully
Microsoft will correct this bug. Until then the way to avoid it is to
call for the same width in the object code as the actual width of the
..wmv or other video files played by the WMP11. If the actual width of
the video is not what you need for your page layout, then the video
should be re-encoded at the desired width. If you do not heed the above
and have a commercial site, your viewers of slim young ladies in swim
wear you wish to sell may stretch the ladies to the width of Henry VIII
for those using the WMP11 on a non-IE browser until,and if, Microsoft
fixes this bug.!


Hello cwdjrxyz,
Thank you for the pointers.
Reading through video_multiformat2 source,
I am having difficulty with the following:
<object data="http://www.cwdjr.net/ram/realmix.rpm"
type="audio/x-pn-realaudio-plugin" ....

The plugin is loaded from a remote url.
Is there any way to load the player that is installed on the local
desktop instead?
When disconnected from the internet, the user should still be able to
play the AV files.

thanks,
Anil
On Dec 25, 8:01 pm, "cwdjrxyz" <spamtr...@cwdjr.infowrote:

anil.r...@gmail.com wrote:

When the user chooses an AV file to play, based upon the type of file,
I want to use the default installed media player to play it.

I am wondering if this is a good way - any alternatives, suggestions or
improvements?

if( wmv file)
document.write("<OBJECT id=Player
classid=CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6 height="354"
width="479">
<PARAM NAME="autoStart" VALUE="true">
</OBJECT>
");The above and the 2 objects below use an ActiveX classid and thus these

are all thus ActiveX objects. Thus they will not work on most non-IE
browsers as written. In many cases you can use an ordinary object for
both IE and other browsers and avoid invalid embed paths for other
browsers.

if( swf file)
document.write("flash classid")

if(rm file)
document.write("real audio classid")

Qs:
1) How to tell which players are installed on the system?Complicated at best, and subject to change without notice on player

upgrades. Avoid when possible

2) How to make reentrant ie. let user play flash now, then afterwards
in the same browser, play wmv etc.I will give you an example below.

3) Is it possible to minimise or make invisible the players that are
not being played?Yes, an example follows below.

4) what if a player is not installed - will the OBJECT tag fail
gracefully?Yes, if the code is properly written - no player = no display


See my page athttp://www.cwdjr.info/temp/video_multiFormat2.phpand be
sure to read the comments in the source. The page is written mainly to
stream for a high broadband connection. A connection that will not
support over 2Mbps will cause long buffering on some files. It is
possible to offer multiple bitrates for high broadband, low, broadband,
and dialup. Seehttp://www.cwdjr.info/temp/video_multiBR3.php. for an
example of this. Notice that I am using playlist files such as .wax
(for WMP), .rpm for Real players etc. These can contain one or more
video url references to urls for files that WMP, Real, or other player
can play. The SMIL program is directed to the Real player, because Real
has builtin support for most of SMIL2. Some other players have very
limited SMIL support, so you don''t want the SMIL file getting directed
to these. The .mov file required the most complex object, and here I
had to use both ActiveX and object paths as determined by Microsoft
conditional comments.

There is a recent complication for the WMP that everyone who embeds
videos using this player should be aware of. The new WMP11 can be
installed only on Windows XP(and likely Vista) OSs, but there are a
huge number of such OSs out there that may be viewing your videos. If
you embed a video and the width of the video called for in the object
is greater than the actual width for a .wmv file, the width is
stretched to the width called for in the code, but the height is not on
non-IE browsers including recent Opera, Firefox, Mozilla, Netscape, and
Seamonkey. However the image is normal viewed on an IE browser. If you
have a Windows XP OS, the new WMP11 installed, and script turned on,
you can see an example athttp://www.cwdjr.info/temp/video_multiFormat.php. It will view as
normal on IE and distorted on the mentioned non-IE browsers. Hopefully
Microsoft will correct this bug. Until then the way to avoid it is to
call for the same width in the object code as the actual width of the
.wmv or other video files played by the WMP11. If the actual width of
the video is not what you need for your page layout, then the video
should be re-encoded at the desired width. If you do not heed the above
and have a commercial site, your viewers of slim young ladies in swim
wear you wish to sell may stretch the ladies to the width of Henry VIII
for those using the WMP11 on a non-IE browser until,and if, Microsoft
fixes this bug.!



an*******@gmail.com wrote:

Hello cwdjrxyz,
Thank you for the pointers.
Reading through video_multiformat2 source,
I am having difficulty with the following:
<object data="http://www.cwdjr.net/ram/realmix.rpm"
type="audio/x-pn-realaudio-plugin" ....

The plugin is loaded from a remote url.
Is there any way to load the player that is installed on the local
desktop instead?
When disconnected from the internet, the user should still be able to
play the AV files.

The rpm, with the mime type for it given, is just a standard type of
Real playlist file. It points to where the actual media file or files
are stored. This is just standard procedure, and ensures that the
actual media file gets sent to the real player. The Real developer site
has more details on Real than most people ever will wish to know,
including SMIL that Real will play if a SMIL file is directed to it.

The rpm file is:
http://www.cwdjr.net/ram/realmix.smil

In this case it points to the SMIL file at the given url.

If you want to play the smill file locally, you just feed the local
address on the computer where it is stored into the Real Player that
you have brought up. The SMIL2 file is a type of xml file, and in this
case is:

<smil xmlns="http://www.w3.org/2001/SMIL20/Language">
<head>
<layout>
<root-layout width="500" height="450" backgroundColor="blue" />
<region id="video_region" backgroundColor="blue" z-index="1" />
<regPoint id="middle" left="50%" top="50%" regAlign="center" />
<region id="brush_region_1" width="25%" height="50%" left="0" top="0"
z-index="2" />
<region id="brush_region_2" width="25%" height="50%" left="25%" top="0"
z-index="2" />
<region id="brush_region_3" width="25%" height="50%" left="50%" top="0"
z-index="2" />
<region id="brush_region_4" width="25%" height="50%" left="75%" top="0"
z-index="2" />
<region id="brush_region_5" width="25%" height="50%" left="0" top="50%"
z-index="2" />
<region id="brush_region_6" width="25%" height="50%" left="25%"
top="50%" z-index="2" />
<region id="brush_region_7" width="25%" height="50%" left="50%"
top="50%" z-index="2" />
<region id="brush_region_8" width="25%" height="50%" left="75%"
top="50%" z-index="2" />
</layout>
<transition id="fromBlue" type="spiralWipe" subtype="topLeftClockwise"
dur="5s" />
<transition id="fromStar" type="starWipe" subtype="fivePoint" dur="5s"
/>
<transition id="fromKeyhole" type="miscShapeWipe" subtype="keyhole"
dur="5s" />
<transition id="fromHexagon" type="hexagonWipe" subtype="vertical"
dur="5s" />
<transition id="fromBarnZigZag" type="barnZigZagWipe"
subtype="vertical" dur="10s" />
<transition id="fromFourBox" type="fourBoxWipe" subtype="cornersIn"
dur="10s" />
<transition id="fromPinWheel" type="pinWheelWipe" subtype="fourBlade"
dur="5s" />
<transition id="fromSnake" type="snakeWipe" subtype="topLeftHorizontal"
dur="10s" />
<transition id="toBlue" type="fade" subtype="fadeToColor"
fadeColor="blue" dur="5s" />
<transition id="toRed" type="fade" subtype="fadeToColor"
fadeColor="red" dur="5s" />
<transition id="toGreen" type="fade" subtype="fadeToColor"
fadeColor="green" dur="5s" />
<transition id="toYellow" type="fade" subtype="fadeToColor"
fadeColor="yellow" dur="5s" />
</head>
<body>
<seq>
<img src="chttp://www.cwdjr.net/ram/roach.gif" id="image1"
region="video_region" dur="34s" width="256" height="256" left="0"
top="0" fill="hold" title="The SMIL Bug">
<animate targetElement="image1" attributeName="width" from="256"
to="128" begin="3s" dur="4s" fill="freeze" />
<animate targetElement="image1" attributeName="height" values="256;128"
calcMode="linear" begin="4s" dur="4s" fill="freeze" />
<animate targetElement="image1" attributeName="left" to="196"
begin="9s" dur="4s" fill="freeze" />
<animate targetElement="image1" attributeName="top" to="196"
begin="14s" dur="4s" fill="freeze" />
<animateMotion targetElement="image1" to="-128,-128" begin="19s"
dur="4s" fill="freeze" />
<set targetElement="image1" attributeName="left" to="64" begin="24s"
fill="freeze" />
<set targetElement="image1" attributeName="top" to="64" begin="24s"
fill="freeze" />
<animate targetElement="image1" attributeName="height" to="256"
begin="26s" dur="4s" fill="freeze" />
<animate targetElement="image1" attributeName="width" to="256"
begin="26s" dur="4s" fill="freeze" />
<animateMotion targetElement="image1" to="0,0" begin="30s" dur="4s"
fill="freeze" />
</img>
</seq>
<seq>
<par>
<audio
src="chttp://www.cwdjr.net/souopera/Tetrazzini_CaroNome_1911.rmj"
title="Caro Nome RA" author="Tetrazzini" />
<img src="chttp://www.cwdjr.net/picsnap/roscoe_foil2.jpg"
region="video_region" regPoint="middle" transIn="fromBarnZigZag"
transOut="toGreen" begin="2s" fill="remove" dur="240s" z-index="3" />
</par>
</seq>
<!-- remove comment tags from around below code to play midi. It is not
included here as Real may ask you to install the Crescendo plugin to
play the midi. -->
<!--
<seq>
<par>
<audio src="chttp://www.cwdjr.net/ram/cancan.mid" title="Cancan mid" />
<img src="chttp://www.cwdjr.net/picani/dancer_blacktights.gif"
region="video_region" regPoint="middle" transIn="fromStar"
transOut="toYellow" begin="2s" fill="remove" dur="120s" />
</par>
</seq>
-->
<seq>
<par>
<audio src="chttp://www.cwdjr.net/souearly/ColumbiaExpositionMarch.wma"
title="Columbia Exposition March WMA" author="Sousa" />
<img src="chttp://www.cwdjr.net/picsnap/roscoe.jpg"
region="video_region" regPoint="middle" transIn="fromFourBox"
transOut="toYellow" begin="2s" fill="remove" dur="148s" />
</par>
</seq>
<seq>
<par>
<audio src="chttp://www.cwdjr.net/ram/SidewalksOfNewYork.mp3"
title="Sidewalks Of New York MP3" />
<img src="chttp://www.cwdjr.net/pic3/burlesque_house2.jpg"
region="video_region" regPoint="middle" transIn="fromSnake"
transOut="toRed" begin="2s" fill="remove" dur="95s" />
</par>
</seq>
<seq>
<par>
<audio src="chttp://www.cwdjr.net/ram/ZarahLeander.ram" title="Zarah
Leander RA" />
<img src="chttp://www.cwdjr.net/ram/aurora5f.jpg" region="video_region"
regPoint="middle" transIn="fromStar" transOut="toBlue" begin="2s"
fill="remove" dur="158s" />
</par>
</seq>
<seq>
<video src="chttp://www.cwdjr.net/ram/eyeslicesmall.ram"
region="video_region" regPoint="middle" title="eye slice - RM"
transIn="fromPinWheel" transOut="toRed" begin="2s" fill="remove"
dur="70s" />
</seq>
<seq>
<video src="chttp://www.cwdjr.net/ram/pianopullsmall.ram"
region="video_region" regPoint="middle" title="piano pull - RM"
transIn="fromHexagon" transOut="toRed" begin="2s" fill="remove"
dur="119s" />
</seq>
<seq>
<video src="chttp://www.cwdjr.net/ram/Nosferatu.rmvb"
region="video_region" regPoint="middle" title="Nosferatu - RM"
transIn="fromStar" transOut="toRed" begin="2s" fill="remove" dur="175s"
/>
</seq>
<seq>
<par>
<video src="chttp://www.cwdjr.net/ram/caligari.rmvb"
region="video_region" regPoint="middle" title="Cabinet Of Dr Caligari -
RM" begin="4s" />
<brush color="teal" region="brush_region_1" begin="0s" end="7s" />
<brush color="fuchsia" region="brush_region_2" begin="0.5s" end="9s" />
<brush color="olive" region="brush_region_3" begin="1s" end="5s" />
<brush color="red" region="brush_region_4" begin="1.5s" end="11s" />
<brush color="purple" region="brush_region_5" begin="2s" end="12s" />
<brush color="blue" region="brush_region_6" begin="2.5s" end="8s" />
<brush color="maroon" region="brush_region_7" begin="3s" end="10s" />
<brush color="navy" region="brush_region_8" begin="3.5s" end="6s" />
</par>
</seq>
<seq>
<par>
<audio src="chttp://www.cwdjr.net/ram/donkey.wav" title="donkey wav"
begin="7s" />
<img src="chttp://www.cwdjr.net/pic/horse_fanny3.jpg"
region="video_region" regPoint="middle" transIn="fromBlue"
transOut="toRed" begin="2s" fill="remove" dur="15s" />
</par>
</seq>
</body>
</smil>

Of course you would also have to point image files to where you store
these on the computer also if you want to be offline when you play the
media.

All of these media are designed for progressive download streaming on a
website. Of course you could store all of the media files in the same
directory as the SMIL file and use relative urls to make it more simple
to play offline. However, I did not care to duplicate a lot of long
media files that I already had stored at various locations on the
server.


这篇关于如何在浏览器中播放不同类型的音视频文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆