Local Media File

Aug 11, 2010 at 3:14 PM

Hi,

I'm trying to use the Progressive Player using the example listed on the downloads page. Embedding and using the player seems to be working, but if I try to use a local source as the mediafile, the jscript crashes.

I'm setting the VideoUrl in the codebehind (using a public variable referenced in a codeblock on the aspx page). I set the variable to the static source in the example, it works. If I set it to a file located in the project, it does not. The file used in the example is a wmv file, and the file I'm trying to set from a local relative filepath is also a WMV. 

The complete error I'm getting is:

Microsoft JScript runtime error: Unhandled Error in Silverlight Application Invalid URI: The format of the URI could not be determined.   at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)   at System.Uri..ctor(String uriString)

I'm hoping this has to do with me setting the variable incorrectly, and looking to see if anyone has encountered (and/or solved) this issue.

Thank you for your time.

Sincerely,

Kosko

Aug 11, 2010 at 3:44 PM

Also,

If I use a full path to a file on my computer, such as:

C:\Users\user\Desktop\code\Videos\Untitled2.wmv

The player does not throw an error, but it does not play the video either.

All help is greatly appreciated.

Kosko

Aug 11, 2010 at 3:57 PM
Well it wouldn't throw an error that would cause it to crash, it will throw the event MediaFailed. That kind of path will probably not work if you're SL player is being hosted on a page that is running on a webserver, the only way I think it might work is if you were going to the page via the file protocol (like) file:///C:/...
Aug 11, 2010 at 4:10 PM

Thank you for that tip, but I tried adding that file:/// to the path but it still won't load up. For what its worth, I entered the same path into the browser and it downloaded immediately; so the file is in the correct location.

Coordinator
Aug 11, 2010 at 6:37 PM

Is your application running in Out of Browser mode?  If not, the application may not have access to the file.

Aug 20, 2010 at 1:22 AM

I am having the same problem. I do not know if I am running in "Out of Browser" mode. How do I check, and how do I enable that feature. Also, what are the implications if I do or do not enable that feature?

Thank you much.

Aug 24, 2010 at 7:04 PM

An alternative method is to host the file on your local IIS server. One problem I ran into when doing this was that the default IIS installation does not give your application the correct permissions when using "Pass Through Authentication". Therefore, make sure that the "Pass Through Account" has read access to the path where your video file is located. Usually, the "Pass Through Account" is the same account that your application's app pool is using. For normal installations this will be the Network Service built-in account.

Sep 18, 2010 at 11:43 PM

l3a0, can you give a little more detail as to how you did this please? I am trying to play files that are on my local web server as well, but not sure how to set the file location. I have tried setting it like this ("~/videos/somefile.wmv") but that hasnt worked. You can see my post here as well. http://smf.codeplex.com/Thread/View.aspx?ThreadId=78850

Thanks

 

Sep 30, 2010 at 10:45 PM

From everything I have read and tried, I don't think it's possible to truly use a relative path. But if you know where the site it going to live you you can create the url as a string variable and just append it.

string url = "http://localhost:55868/ClientBin/";
ChangeMediaItem(url + "HaloWars.wmv");

If you don't know where it's going to live you can do a Server.MapPath in the asp.net page to find out where the page is and pass it.

Would this be a viable work around?