Shared Media wrapper

From Second Life Wiki
Jump to navigation Jump to search

About

A situation that's becoming increasingly common: say you want to show a some content, like a Flash video, and only that content on a prim's face via Shared Media.

However, if you enter in a normal URL, like http://vimeo.com/9656041 , it shows everything on the page.

You might think, "Maybe I can just directly link to the Flash file?"

Alas, Shared Media in its current implementation doesn't officially support direct-linking to FLV/SWF files. (When Torley tested this, it worked on Mac but not Windows.)

What you can do that achieves the same end result is use a wrapper.

Basically:

  1. Place the code you want within the wrapper.
  2. Convert the code into a data: URI, which is often the quickest way to show it inworld. Or if you'd prefer, insert the code into a webpage and upload it.

Wrappers

Here's Torley's 1st pass at a wrapper. Surely it can be optimized and improved upon — if you've adapted it, add your version below!

<html4strict> <html>

<head>
 <title>Wrapper</title>
</head>
<body marginheight="0" marginwidth="0" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" style="overflow:hidden">
  <object width="100%" height="100%">
  <param name="movie" value="http://torley.s3.amazonaws.com/panoramas/Here.swf">
  <embed src="http://torley.s3.amazonaws.com/panoramas/Here.swf" width="100%" height="100%" type="application/x-shockwave-flash">
  </embed>
  </object>

</body>

</html> </html4strict>

Replace the two instances of http://torley.s3.amazonaws.com/panoramas/Here.swf with your own URL. What this code does:

  • Removes the white border that would be present by default around the edges of the Flash object.
  • Centers the content on the prim. Not always required but there if you do need it, like if you're including additional text or embedding an object that fills the vertical but not the horizontal space.

Depending on the source embed code, you may be able to completely replace the stuff between the <object> tags but make sure width="100%" and height="100%" stay the same if you want the content to fill the prim's face.

Many sites have a "share" or "embed" button you can click, then copy the code over. For example, this is for the same Vimeo video used above, with the default width="640" and height="480" both changed to 100%:

<html4strict> <html>

<head>
 <title>Wrapper</title>
</head>
<body marginheight="0" marginwidth="0" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" style="overflow:hidden">
  <object width="100%" height="100%">
  <param name="allowfullscreen" value="true" />
  <param name="allowscriptaccess" value="always" />
  <param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=9656041&server=vimeo.com&show_title=0&show_byline=0&show_portrait=0&color=FF0080&fullscreen=1" />
  <embed src="http://vimeo.com/moogaloop.swf?clip_id=9656041&server=vimeo.com&show_title=0&show_byline=0&show_portrait=0&color=FF0080&fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="100%" height="100%">
  </embed>
  </object>

</body>

</html> </html4strict>

The resulting data URI looks like this (observe your browser's location bar), which you can go ahead and paste into Shared Media for a prim's face:

Flash video wrapper.png

Experiment for yourself and see!

KBcaution.png Important: Made a wrapper? Add it here and include helpful comments on its usage!

<html4strict> <html>

</html> </html4strict>

See also