Difference between revisions of "User:Salahzar Stenvaag/classes/StreamingMedia"

From Second Life Wiki
Jump to navigation Jump to search
(New page: '''Class''': How to stream and generate object to display movies, webpages, images etc. '''Instructor''': Salahzar Stenvaag (SL Mentor) '''Date''': August 17th 2008 '''Location''': Isht...)
 
 
Line 142: Line 142:
     4. Caveats and troubleshooting
     4. Caveats and troubleshooting
      
      
0. Why we need a scripted object.
 
== 0. Why we need a scripted object. ==
 


We can use the powerful media manual interfaces but ONLY if we are owner of the land, owners of the group if land is deeded or officers with enough capabilities.
We can use the powerful media manual interfaces but ONLY if we are owner of the land, owners of the group if land is deeded or officers with enough capabilities.

Latest revision as of 13:46, 13 August 2008

Class: How to stream and generate object to display movies, webpages, images etc.

Instructor: Salahzar Stenvaag (SL Mentor)

Date: August 17th 2008

Location: Ishtar Lagoon Buddhismo Italia - Pergola(25,155,24)


Brief description:

Streaming video, webpages and images is one of the most powerful features SecondLife offers for communities, companies or individuals to share visual content, but the setting up process is quite confusing, difficult and error prone. I set up this class to explain the basics of "Media Parcel" setting and how to simply script an object to take advantage of this feature in a simpler, effective and "shared way".

NB: Content of this class is not endorsed by SecondLife (disclaim needed), while it is part of a Volunteer Teaching experience organized by SL Mentors. If you need more information on SecondLife Mentors you are welcome to ask me after the class is finished.


Prerequisites:

To understand this class you should be comfortable with the basics of group handling, object properties editing, and at least a minimal scripting ability: we are not teaching what a group is or how to compile "Hello Avatar" :)

Part I: Media Content

   0. Introduction
   1. How to enjoy a stream
   2. How to set media content on a parcel
   3. What happens if land is deeded to a group?
   4. Deeding caveats and permissions issues
   


0. Introduction

The ability of showing movies, web pages or photo stills in SecondLife is achieved using the special "Media" tab in the land dialog. Recently (starting from April 2008) it has become more powerful allowing you to display webpages or images directly without using quicktime as intermediate. Quicktime is still required for basic functionality to work. We are dealing in particular with visual media.

There are many video showing you how this works. Torley made some very interesting and exhaustive video at the following address: http://blog.secondlife.com/2008/03/10/parcel-media-video-tutorials-how-to-play-movies-webpages-more/ You are invited to see his videos being quite well done and instructive. However we will cover this live since live experience is always a good thing :)

To show multimedia content you must own a piece of land since multimedia is connected with the land ownership.

==> If you don't own a piece of land you can still be in a group who owns land and as officer you might be allowed to set media content.

Each parcel can have one and one only multimedia stream associated, so if you need to show, say 10 movies at the same time and 5 images from the web you must subdivide the land in at least 15 subparcels. Note that avatars can see a stream only when they are IN the same parcel as the stream is set.

Questions?


1. How to enjoy a stream.

If you are in a parcel where streaming has been set you can enjoy it just pressing the "play" button on the bottom of your screen just at the right of "gesture" combobox, above "mini-map" button.

If it is grayed then you MUST go to CTRL-P preferences audio and video and tick "Play Streaming Media". Also you can choose to tick "Automatically Play Streams when available". This can save you some time.

Questions?


2. How to set media content

If you have correct rights (being owner of a parcel or an authorized officer, you can click on the "About Land" and being shown the Land characteristics. Right-Click on the ground and click "ABout Land", or click on the name of the land on the top of your browser, whichever is best for you. I personally prefer clicking on the top name: it is faster and you can do it even if you are flying in the sky or on a platform.

Click on the Media tab. You can then choose the following:

  • Media Type: which type of media to display (you can ignore it since it is automatically chosen when choosing the url).
  • Media URL: you can "Set..." it to a valid URL or a movie source (Warning: be careful to change in Set.. and NOT in description since it has no effective meaning
  • Replace Texture show you which texture in the parcel is used to show multimedia content. You can set one of your texture so to show help or other land specific texture instead of a greyed or white one.
  • Auto Scale: normally is ticked so that the media will cover ALL the prim and not just a portion.

We skip the sound part of media texture, since it is not part of this class.

Whenever you have problems with media (and you are owner), be sure that you are able to set this page so you can deduce that everything is fine with streaming in the parcel.

Questions?


3. What happens if land is deeded to a group?

First of all 2 words on the concept of "deeding" and groups, which are quite complex and awkward things in Secondlife. Groups have been created to help communities to share land, activities and to define roles. Some people in the group are just "members", others are "officers" depending on a complex matrix of permissions and capabilities. Permissions can be set to allow members of a role to build things, to eject other members, to deed objects and use them, and to set media parcel properties.

We are interested in deeding since our ultimate goal is to build a scripted object able to change the media permissions for us without needing to go manually on the "About Land" and doing it with keystrokes.

An Object like a Wallboard or a Screen or a TV can change the parcel Media Properties ONLY if it is deeded to the group. This is why we are talking about groups and deeding. :)

Deeded land is more complex than simple avatar owned land. In the second, simplest case, object can change media property just because it is owned by the avatar owning the parcel. In the first more complex case object must be owned by the group. Not just *shared* it must be DEEDED.

Questions?


4. Deeding caveats and permissions issues

Whenever you deed something to a group you are NO MORE owner of that thing (this is valid for lands but even more with objects). So deeding it is actually a TRANSFER. Even if you are owner of the group, when you deed something to the group you lose the object and you might not be able to get it again back in your inventory with the same permissions :(

This is something very tricky and since many commercial objects are normally notrans to avoid reselling, if you buy something that should act as media parcel changer it MUST be transfer to allow DEEDING. Sellers normally dislike the fact that you can make multiple copies of their objects and so if they sell something TRANSFER they remove the COPY right.

There should not be any problems with FULL PERMISSIONS objects, but here again there are some subtle bugs in SecondLife that might prevent you in having the same thing (i.e. a full permission object when rezzed, deeded, taken can become nocopy nomodify at the end). So you are advised if possible to keep copies in your inventory.

To show you the "correct" sequence to do when deeding an object to a group let assume we have a box with 1 script and 2 notecards.

  • You must be sure the object is at least TRANSFER (copy/modify is better). Check that next owner can also TRANSFER it (and copy/modify as well).
  • rez the object and SHARE with the group (the *correct* group be careful to have the proper tag on your head),
  • be sure also to SHARE with the group and to check each permissions of contained items!!!!
  • at this point you DEED the object to the group BUT READ below

You must be the owner of the group or have the following capabilities from the group in your role:

  • Change music & media settings (if you want to be able to check Media Properties of the land)
  • Return objects owned by group (to be able to reclaim your object)
  • Deed objects to group
  • Manipulate (move,copy,modify) group objects )

Whenever you DEED an object and have modify rights on it, be sure to share it again with the group AND RESET scripts in it. (Simplest way to do it is to right-click, edit and from Tools menu choose Reset Scripts in selected objects.

Reset is *QUITE* important to be sure that scripts are working under the correct identity. If you don't reset the object the object might easily simply not work :(

Questions?

'At the end of this part you should be comfortable with what is media content, how to set it manually and how it relates with scripted objects. '


Part II: Scripted Media Object

   0. Why we need a scripted object
   1. The basic lsl command llParcelMediaCommandList
   2. A very simple "web browser" listening to a channel to change URL
   3. Other usages
   4. Caveats and troubleshooting
   

0. Why we need a scripted object.

We can use the powerful media manual interfaces but ONLY if we are owner of the land, owners of the group if land is deeded or officers with enough capabilities. This can be however a bit cumbersome since you have to open up the dialog from about land and choose the url (You might as well use your browser where there is an option which puts automatically current url on the media settings if you want people to surf with you the web).

But if you want to automate the URL changing, for example in an unattended presentation, or if you want people not in your group to be able to choose their own url / movies, you MUST definitely have some scripted objects.

When you have scripted objects you enter in the issues I explained before (deeded objects, transfer hell etc). We give for granted that you know how to deal with that mess (this is why I divided the class in 2 parts) :) And concentrate on the scripting part.

Questions?


1. The basic command.

lsl scripting gives you a powerful and lengthy command which does "everything" related to setting media properties. llParcelMediaCommandList( [list] ); accepts a list of commands for instance:

llParcelMediaCommandList( [

           PARCEL_MEDIA_COMMAND_URL, "http://enter_your.url/here",
           PARCEL_MEDIA_COMMAND_TEXTURE, (key) llGetTexture(0) ] );

Which uses as texture the first texture contained in the object inventory and sets a URL to show.

You can also use the following commands:

PARCEL_MEDIA_COMMAND_STOP     
PARCEL_MEDIA_COMMAND_PAUSE  
PARCEL_MEDIA_COMMAND_PLAY    
PARCEL_MEDIA_COMMAND_LOOP    
PARCEL_MEDIA_COMMAND_TEXTURE (key)" " (typecast to key!!!)
PARCEL_MEDIA_COMMAND_URL  " "  (254 chars!)
PARCEL_MEDIA_COMMAND_TIME   float  (to skip to a specific time in video)
PARCEL_MEDIA_COMMAND_AGENT    (key) (to apply movie to a specific avatar.. Warning it is allegedly buggy)
PARCEL_MEDIA_COMMAND_UNLOAD   (remove movie)
PARCEL_MEDIA_COMMAND_AUTO_ALIGN    
PARCEL_MEDIA_COMMAND_TYPE    " "
PARCEL_MEDIA_COMMAND_SIZE    x, y
PARCEL_MEDIA_COMMAND_DESC    " "

See http://lslwiki.net/lslwiki/wakka.php?wakka=llParcelMediaCommandList for a detailed comment of this.

Questions?


2. A very simple "web browser" listening to a channel to change URL

default
{
   state_entry()
   {
       string s=llGetInventoryName(INVENTORY_TEXTURE,0);
       key k=llGetInventoryKey(s);
       
       llSetTexture(s,0);
       llParcelMediaCommandList([PARCEL_MEDIA_COMMAND_TEXTURE, k ]);
       
       llListen(10,"",NULL_KEY,"");
       llSay(0,"Say http://url on channel 10");
      
    }
    listen(integer channel, string name, key id, string str)
    {
       llSay(0,"Refreshing URL: "+str+"...");
       llParcelMediaCommandList([PARCEL_MEDIA_COMMAND_AUTO_ALIGN, 1,  PARCEL_MEDIA_COMMAND_STOP, PARCEL_MEDIA_COMMAND_TYPE, "text/html", PARCEL_MEDIA_COMMAND_URL, sURL, PARCEL_MEDIA_COMMAND_PLAY ]);
       llSay(0,"Done.");
    }
}

Questions?


3. Other Usages

In connection with http_request (it is out of the scope of current class), we can do quite miracolous things like: - showing notecards (converting notecard to html and showing the html page) - we can also do an almost real browser just listening to the name of a link and asking to follow that link - we can listen to chat and have an interactive whiteboard where the content comes from the chat and many other usages.


4. Trouble shooting.

Here again I've seen a LOT of people who get confused when they have a streaming object and have to use it. Whenever they see that the screen simply remains blank they tend to be nervous and to give up or to blame the programmer or the Lindens. Here again the correct way of dealing with problems is trying to check the following:

  • is the media parcel working "manually" correctly? i.e. are you (or the owner or the officer) able to manually change the media parcel and show the movie the URL correctly?
  • is the object correctly DEEDED to the group? In case try to use it in a normally owned land to check if it is correctly working.
  • is Quicktime and media enabled on your browser?
  • are you in the correct parcel?

For instance a sequence of problems and how to solve them can be found at the following page:

http://www.slguide.com/help/

Questions?

Thanks for the participation. :)