Difference between revisions of "Shared Media wrapper"

From Second Life Wiki
Jump to navigation Jump to search
 
(11 intermediate revisions by one other user not shown)
Line 1: Line 1:
A situation that's becoming increasingly common: '''say you want to show a Flash object, like a video, and ''only'' that content on a prim's face via [[Shared Media]]'''.
== About ==


However, if you enter in a normal URL, like http://youtube.com/watch?v=cWLeJ4xziwo , it shows ''everything'' on the page.
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]]'''.


You might think, "Maybe I can just directly link to the Flash file?" 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.)
However, if you enter in a normal URL, like http://vimeo.com/9656041 , it shows ''everything'' on the page.


What you can do that achieves the same end result is use a ''wrapper''.
You might think, "Maybe I can just directly link to the Flash file?"


Basically, you place the code you want within the wrapper, then paste the whole thing as a [[data URI]] or put it on a webpage by itself.
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:
 
# Place the code you want within the wrapper.
# Convert the code into a '''[[data URI|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 ==
== Wrappers ==
Line 13: Line 20:
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!
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!


<pre>
<html4strict>
<html>
<html>
  <head>
  <head>
Line 30: Line 37:
  </body>
  </body>
</html>
</html>
</pre>
</html4strict>


Replace the two instances of <code>http://torley.s3.amazonaws.com/panoramas/Here.swf</code> with your own URL. What this code does:
Replace the two instances of <code>http://torley.s3.amazonaws.com/panoramas/Here.swf</code> with your own URL. What this code does:
Line 37: Line 44:
* 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.
* 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 <code><object></code> tags. For example, this is for a Vimeo video:
Depending on the source embed code, you may be able to completely replace the stuff between the <code><object></code> tags ''but'' make sure <code>width="100%"</code> and <code>height="100%"</code> 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 <code>width="640"</code> and <code>height="480"</code> both changed to <code>100%</code>:


Experiment and see!
<html4strict>
<html>
<head>
  <title>Wrapper</title>
</head>
<body marginheight="0" marginwidth="0" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" style="overflow:hidden">
  <div align="center">
 
  <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&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=FF0080&amp;fullscreen=1" />
  <embed src="http://vimeo.com/moogaloop.swf?clip_id=9656041&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=FF0080&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="100%" height="100%">
  </embed>
  </object>
  </div>
</body>
</html>
</html4strict>
 
The resulting data URI [http://tinyurl.com/ykgcama looks like this] (observe your browser's location bar), which you can go ahead and paste into Shared Media for a prim's face:
 
[[File:Flash_video_wrapper.png|640px]]
 
Experiment for yourself and see!
 
{{KBcaution|Made a wrapper? Add it here and include helpful comments on its usage!}}
 
<html4strict>
<html>
 
</html>
</html4strict>


== See also ==
== See also ==


* '''[https://blogs.secondlife.com/community/community/tnt/blog/2010/03/16/viewer-2-tip-shared-media-show-youtube-on-a-full-prims-face Show YouTube on a full prim's face]''' - YouTube, unlike some sites, has a built-in "show Flash movie on a full page" setup so you may not need the above.
* '''[https://blogs.secondlife.com/community/community/tnt/blog/2010/03/16/viewer-2-tip-shared-media-show-youtube-on-a-full-prims-face Show YouTube on a full prim's face]''' - YouTube, unlike some sites, has a built-in "show Flash movie on a full page" setup so you may not need the above.
* '''[http://code.google.com/p/swfobject/ SWFObject 2]''' - Another way to wrap an object and display it full-face.


[[Category:Shared Media]]
[[Category:Shared Media]]

Latest revision as of 15:10, 24 March 2010

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