• Cross domain in Silverlight Streaming


    In my previous post about cross-domain policy files I received some comments about whether or not cross-domain access is allowed on Silverlight Streaming.  I think really this is two questions that I'll try to clarify here.

    What is Silverlight Streaming?

    For those who don't know, Microsoft provides anyone with an account to "stream" Silverlight applications for free.  We'll give you 10GB of space to put your Silverlight applications.  There are some limitations, which you can read about in the service.  The "streaming" name has confused some.  It isn't only a "where can I put media files" location, but is a service to "stream" your entire Silverlight application.  You can have a media player, or a hello world textbox...no matter.  If you haven't checked it out, sign up.

    Does Silverlight Streaming support cross domain calls from Silverlight?

    This really has to do with the Silverlight Streaming API.  Silverlight Streaming provides an API to manage your applications.  You can perform various activities on your Silverlight Streaming account through this API such as managing your applications, requesting files, etc.

    Now I'm not sure why you would want to access the API from a Silverlight application, but I will say that the in order for this to happen (as noted in my post about cross domain access), the service would have to host a policy file at the end point.  Silverlight Streaming currently does not have that policy file.

    Can my application hosted in Silverlight Streaming access cross domain services?

    This is what I think the question really is in the comments.  Yes.  Provided that the service you are accessing has a clientaccesspolicy.xml file at the root of the site, then yes it could.  I whipped up a quick DataGrid sample and put it on my Silverlight Streaming account.  This is a Silverlight 2 application (xap) that calls the MSN Video POX service via a WebClient call.  I take the information and bind it to a DataGrid.  So this application below is hosted in Silverlight Streaming, calling a 3rd party service (which has a policy file enabled) and embedded within my blog post here.

    I hope that makes it a little clear that yes you can do this with your apps.

    How did you get a Silverlight 2 application on Silverlight Streaming?

    Very easily.  Just a bit after MIX08, the SLS team added support for Silverlight 2 Beta 1 applications.  You can read about it here, but here is the manifest I used for the application you see above:

    <SilverlightApp>
       <version>2.0</version>
       <source>StreamingCrossDomain.xap</source>
    </SilverlightApp>

    I added that manifest.xml and my StreamingCrossDomain.xap file to a zip, uploaded it to my account and done.

    Hope this helps!

    Wednesday, April 09, 2008 12:39 PM

    PostTypeIcon

Comments.

  • Rob Burke said:
    Gravatar
    # re: Cross domain in Silverlight Streaming


    Thank you!! This answers the question perfectly, Tim, complete with inline example of exactly what I hoped to do (and now am about to do) :)

    4/9/2008 12:53 PM
  • Gravatar
    # re: Cross domain in Silverlight Streaming


    Can you tell me more about this "the MSN Video POX service "? I actually looking something like this, whith video, images etc.
    Or put example code?

    Regards,
    Jacek Ciereszko

    4/16/2008 1:58 AM
  • timheuer said:
    Gravatar
    # re: Cross domain in Silverlight Streaming


    jacek: good question...to be honest, i'm not sure where all the methods are fully documented, but http://catalog.video.msn.com/randomvideo.aspx?mk=us&vs=0&ff=99&c=10 is an endpoint to random videos, you can see some demonstrations here http://timheuer.com/blog/archive/2008/04/08/anaheim-2008-silverlight-presentation.aspx

    4/16/2008 6:26 AM
  • Gravatar
    # re: Cross domain in Silverlight Streaming


    Tim, so they are random videos without opportunities to upload my own video there?

    Not good… Because I am creating some kind of “internet-TV/youtube” in Silverlight (example: http://net-event.iis7.pl/SilverTv/TestPage.html) and I was wondering that maybe there is a place that I can upload videos and I get xml with all paths to videos, images, titles and descriptions (like I saw in your grid).

    Now I have all in my local xml file and I have to use WCF Web Service to manage uploading etc. and I want to simplify it. (btw. thx for your description about clientaccesspolicy.xml and “silverlight-cannot-access-web-service” veryyyyyyyyyy useful :D )

    Btw 2.: I did like you said (about silverlight-presentation), I run your example in webbrowser by "view in browser" not from Visual Studio and it works now. Previously, by using F5 it were some security errors.

    Thanks anyway for quick response.
    Jacek Ciereszko

    4/16/2008 11:21 AM
  • timheuer said:
    Gravatar
    # re: Cross domain in Silverlight Streaming


    jacek: msn videos/soapbox has an upload service that you can check out which is where these videos are coming from. i don't know the pointer to the other methods of the web service from videos.

    alternatively there is Silverlight Streaming (silverlight.live.com) which does enable you to upload your own content and has an API as well.

    4/16/2008 11:38 AM

Your Reply.

  Comment Form  

Fields denoted with a "*" are required.

*Your name:
Subject:
Your blog:
Your email:  (will not be displayed)
*Your message:

 
Please add 2 and 7 and type the answer here: