Skip to main content

Microsoft Silverlight

Unanswered Question Crossdomain hosting of XAP for easy embed?RSS Feed

(0)

scs32
scs32

Member

Member

0 points

4 Posts

Crossdomain hosting of XAP for easy embed?

The goal is simple:  I want to create an <object /> type tag which people can include on blogs, webpages, etc.  without needing anything but the snippet of code.

 However, when I set the source to anything but the same domain, I get a blank screen.  As this is a VERY VERY VERY basic concept, I have a hard time believing I'm not being an idiot.  That said, people who have asked similar questions either get no response or, get this, IFRAMES come up.  IFRAMES?  Really? IFrames?

This is possible, right?

ken tucker
ken tucker

All-Star

All-Star

16288 points

2,485 Posts

Re: Crossdomain hosting of XAP for easy embed?

Microsoft Silverlight Streaming uses IFrames

scs32
scs32

Member

Member

0 points

4 Posts

Re: Crossdomain hosting of XAP for easy embed?

Maybe I'm not being clear...

 Are you saying that there is no clean way for people to simply embed a Silverlight player in a webpage/blog/etc.  Really?  Really?  In this day and age of social media/blogs/etc....

 I started down the road of Silverlight thinking "MSFT Version of Flash."  In a million years I wouldn't guess that you can't hand out the same "Embed" concept that's in just about every Flash player out there.

 I have to think that I'm somehow being unclear...

clint1222
clint1222

Participant

Participant

1542 points

216 Posts

Re: Crossdomain hosting of XAP for easy embed?

Hi,

You could just give out the object tag information to your Silverlight xap file.  Update the source value to include full URL information to your xap file.

There isn't a "Silverlight player", it's a browser plug-in the end-user would have to have installed to view the app.  Otherwise they would see the "Get Silverlight" install message.

Perhaps your source was incorrect.  Can we take a look at the object tag code?

scs32
scs32

Member

Member

0 points

4 Posts

Re: Crossdomain hosting of XAP for easy embed?

If I do something like:

 <object id="SilverlightMediaPlayer" width="100%" height="100%" autoupdate="true" type="application/x-silverlight-2">
<param name="enableHtmlAccess" value="true"   />
        <param name="MinRuntimeVersion" value="2.0.31005.0" />
        <param name="Source" value='/videoplayer/AdaptiveStreamingStatsTracker.xap' />
        <param name="windowless" value="false" />

        <param name="InitParams" value='fakemode=,background=#FF000000,autoplay=False,muted=False,stretchmode=0,playlist=<playList><playListItems><playListItem title="Experience Smooth Streaming : The Official Microsoft IIS Site" description="" mediaSource="mediaurl" adaptiveStreaming="True" thumbSource=""></playListItem></playListItems></playList>' />
        <a style="text-decoration: none;" href="http://go.microsoft.com/fwlink/?LinkID=92799">
                <img style="border-width:0px" alt="Install Silverlight" src='http://i3.iis.net/themes/iis/images/slplayer_disabled.png?cdn_id={d0438422}' />
        </a>

</object>

 Everything is great.  However, if I change the Source value to include a website from a different domain name, everything breaks down.

clint1222
clint1222

Participant

Participant

1542 points

216 Posts

Re: Crossdomain hosting of XAP for easy embed?

I would imagine there would have to be either a clientaccesspolicy.xml file in place or a crossdomain.xml file in place to access the resources.  I can find the xap file and look inside but I can't find any policy files.  That object wouldn't work on a different domain page.

Have you created a Silverlight app available to other pages?

dmacdonald
dmacdonald

Member

Member

22 points

17 Posts

Re: Crossdomain hosting of XAP for easy embed?

 I have the same problem. Here is my html code.

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;}

 

<div id="silverlightControlHost">

<object height="300" width="300" type="application/x-silverlight-2" data="data:application/x-silverlight-2,">

<param value="http://a-remote-domain.com/ClientBin/SilverlightClient.xap" name="source"/>

<param value="white" name="background"/>

<param value="3.0.40723.0" name="minRuntimeVersion"/>

<param value="true" name="enableHtmlAccess"/>

<param value="visOnly=true" name="initParams"/>

<a style="text-decoration: none;" href="http://go.microsoft.com/fwlink/?LinkID=149156">

<img style="border-style: none; width: 400px; height: 200px;" alt="Install Microsoft Silverlight" src="http://storage.timheuer.com/sl4wp-ph.png"/></a></object>

<iframe style="border: 0px none ; visibility: hidden; height: 0pt; width: 0pt;"/></div>
   

My clientaccesspolicy.xml is in place and allows web services to be called remotely from all domains, although I dont see how that has direct bearing on this issue. The xap works fine when the url points to a local copy of it. In the scenario above I do not even see an http request go out for the xap, its as if the silverlight plugin decides it doesnt want to even bother fetching it. On the remote host, IIS claims that the mime-type is set correctly.

This is a pretty major class of fail for silverlight, but I know _someone_ has got this working. Any ideas guys?

 Daniel

scs32
scs32

Member

Member

0 points

4 Posts

Re: Crossdomain hosting of XAP for easy embed?

 

It's my understanding that everything is working as it should.  This is just not something that they allow.  IIRC, it was for security reasons.  To the best of my knowledge you'll need to use iframes where the remote server will actually host a page and you place that "page" in an iframe.

 

dmacdonald
dmacdonald

Member

Member

22 points

17 Posts

Re: Crossdomain hosting of XAP for easy embed?

This working example

 

 http://www.rhizohm.net//irhetoric/blog/99/default.aspx

 

and Tim Heuer's wordpress plugin both imply that it should be possible without iframes....I just cant figure out what I'm doing wrong.

clint1222
clint1222

Participant

Participant

1542 points

216 Posts

Re: Crossdomain hosting of XAP for easy embed?

Hi Daniel,

A couple of quick things to check.  The clientaccesspolicy.xml file is located at the host of the xap file ( http://a-remote-domain.com) correct?

Also, IIS doesn't recognize the clientaccesspolicy.xml file right away, it requires a restart.

dmacdonald
dmacdonald

Member

Member

22 points

17 Posts

Re: Crossdomain hosting of XAP for easy embed?

 Yes it is, and its been restarted many times, and I know it works at least for my web services...

KirillOsenkov
KirillOs...

Member

Member

4 points

2 Posts

Re: Crossdomain hosting of XAP for easy embed?

Make sure that the .html file where you're putting the <object> tag is on a web server, not on the local filesystem. It will only work when the .html is loaded from the http: (the web) but not file: (local filesystem). http://localhost should work.

Hope this helps,

Kirill

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities