开发者

Does a silverlight video player always need source address in URL format only?

开发者 https://www.devze.com 2022-12-25 05:46 出处:网络
I have seen on many sites the silverlight video player. I noticed that all of them took a URL as the source of the video file.

I have seen on many sites the silverlight video player. I noticed that all of them took a URL as the source of the video file.

Can a silverlight player play a video file kept locally?

I mean 开发者_JS百科a simple HTML file kept in a folder with the xap (say VideoPlayer.xap) and the video (say ABC.avi) file.

The html file would contain an object tag. For example:

<object height="240" width="500" type="application/x-silverlight-2" data="data:application/x-silverlight,">
            <param value="VideoPlayer.xap" name="source">
            <param value="onSilverlightError" name="onerror">
            <param value="white" name="background">
            <param value="cc=true,markers=true,markerpath=markers_movie21.xml,m=ABC.avi" name="initParams">
            <a style="text-decoration: none;" href="http://go.microsoft.com/fwlink/?LinkID=115261">
                <img style="border-style: none;" alt="Get Microsoft Silverlight" src="http://go.microsoft.com/fwlink/?LinkId=108181">
            </a>
        </object>


There is no constraint of giving video source as URL. You can always give path of local file to be played in video.


Yes, you can specify a URI that is within your XAP a couple of different ways. For a good resource on this, go here:

http://nerddawg.blogspot.com/2008/03/silverlight-2-demystifying-uri.html

For example, if you wanted to specify a video located in your XAP under /videos/MyVideo.avi you could specify the source like this within your XAML or code:

Source="/{assemblyShortName};/videos/MyVideo.avi"

Also, it may go without saying, but unless your project requires this for some reason, including the video within the XAP will increase the download time significantly for the .XAP file, so if at all possible, locate the video outside of the XAP file.

0

精彩评论

暂无评论...
验证码 换一张
取 消