标签云

微信群

扫码加入我们

WeChat QR Code

We are using WMV videos on an internal site, and we are embedding them into web sites. This works quite well on Internet Explorer, but not on Firefox. I've found ways to make it work in Firefox, but then it stops working in Internet Explorer.

We do not want to use Silverlight just yet, especially since we cannot be sure that all clients will be running Windows XP with Windows Media Player installed.

Is there some sort of Universal Code that embeds WMP into both Internet Explorer and Firefox, or do we need to implement some user-agent-detection and deliver different HTML for different browsers?


Cross browser solution that always works... How to stream music or audio from your website: nunzioweb.com/streaming_audio-example.htm

2018年07月19日00分22秒

When I use this method I am not able to control the player through JavaScript. For example, mediaplayer.controls is undefined. Is there a cross-browser way that also allows this?

2018年07月19日00分22秒

that's because the object has the id but the embed element is being run. You'd be better off giving both elements a "unique" class, selecting both, and filter out the one that's active.

2018年07月19日00分22秒

Mind, that since version 7.0, the class id has been changed to 6BF52A52-394A-11d3-B153-00C04F79FAA6. See e.g. here.

2018年07月19日00分22秒

I highly recommend this link from Elizabeth Castro, as the code is much leaner and doesn't require a classid. Also, the guy below me actually recommended the article first.

2018年07月19日00分22秒

id say this is a naive comment iPlayer has it easy compated to other products largely because their "DRM" is simply a case of working out where someone is through GeoIP. Flash is lucky it has no competition with its third rate programming language and a flawed runtime -1 way too subjective, the question was asking how to embed WMP in all browsers... what does flash have to do with that???

2018年07月19日00分22秒

It's an alternative approach - what's naive about suggesting alternatives?

2018年07月19日00分22秒

Might not be true anymore, now that we have HTML5.

2018年07月19日00分22秒

As the original comment states contemplating using Silverlight, this comment is definitely valid as an opinion from one source.

2018年07月19日00分22秒

This works, but in Firefox the entire video is downloaded before it will start playing. Obviously this creates a rather long loading screen. Is there any way to have this stream the video in Firefox?

2018年07月19日00分22秒

Unfortunately I did'nt find way(s) to prevent this problem. Apparently, this is the nature of WMP object on Firefox. For this reason, I use window's load event, because this is latest point(moment) of page's markups(resources) interpretation. Setting the data attribute after loading the page, maybe decrease the loading time (obviously not 100%!). Good luck.

2018年07月19日00分22秒

I found a solution. Changed the type of the firefox player to video/x-ms-wmv. I also noticed that firefox and chrome couldn't play videos which had spaces in the title. I fixed this by replacing all empty spaces in the videoUrl string with '%20' and then it worked fine

2018年07月19日00分22秒

Great Job! I changed my codes: Line 15: videoUrl = encodeURI(videoUrl); and Line 19: //player += 'type="application/x-ms-wmp" '; Line 20: player += 'type="video/x-ms-wmp" ';

2018年07月19日00分22秒