How do I get the Silverlight player to work in Med

2019-08-05 13:38发布

问题:

I'd like to add the Silverlight player to the list of players in the multi-codec support HTML since I'd like to serve up WMV files in addition to the other supported codecs, but I don't see much documentation on the website for enabling the Silverlight version other than launching it via JavaScript.

I'm at a bit of a loss, since I've tried a few variations of what I've posted below and haven't had any success. I've looked through the mediaelement-and-player.js source, but nothing jumps out at me as to what I need to do in HTML. Does anyone have any suggestions / tips on what I need to do to get the HTML based Silverlight version working?

If this can't be done via HTML, that's ok too - but please provide a clear example.

Many thanks, Jim

<video width="320" height="240" poster="poster.jpg" controls="controls" preload="none">
<!-- MP4 for Safari, IE9, iPhone, iPad, Android, and Windows Phone 7 -->
<source type="video/mp4" src="myvideo.mp4" />
<!-- WebM/VP8 for Firefox4, Opera, and Chrome -->
<source type="video/webm" src="myvideo.webm" />
<!-- Ogg/Vorbis for older Firefox and Opera versions -->
<source type="video/ogg" src="myvideo.ogv" />
<!-- Optional: Add subtitles for each language -->
<track kind="subtitles" src="subtitles.srt" srclang="en" />
<!-- Optional: Add chapters -->
<track kind="chapters" src="chapters.srt" srclang="en" /> 
<!-- Flash fallback for non-HTML5 browsers without JavaScript -->
<object width="320" height="240" type="application/x-shockwave-flash" data="flashmediaelement.swf">
    <param name="movie" value="flashmediaelement.swf" />
    <param name="flashvars" value="controls=true&file=myvideo.mp4" />
    <!-- Image as a last resort -->
    <img src="myvideo.jpg" width="320" height="240" title="No video playback capabilities" />
</object>
<object width="320" height="240" type="application/x-silverlight-2" data="silverlightmediaelement.xap">
    <param name="movie" value="silverlightmediaelement.xap" />
    <param name="flashvars" value="controls=true&file=myvideo.wmv" />
    <!-- Image as a last resort -->
    <img src="myvideo.jpg" width="320" height="240" title="No video playback capabilities" />
</object>

回答1:

Turns out I needed to specify that the file was of type video/wmv. If anyone else runs into this, you can probably add something like

 <source type="video/wmv" src="myvideo.wmv" />

to the list of formats.

I'm using an HTML template engine (Velocity) and putting the type in on the fly, so the video-for-everybody may end up being slightly different.