Jump to content

How to know that a user has cliked play or stop in Media on Prim (shared media) controls?


RedEagle87
 Share

You are about to reply to a thread that has been inactive for 4053 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hello everybody, I would like first to thank all the people who are answering my questions and to thank their contribution to the LSL scripting forum.

1)As a continution of what I am developping (HUD with multimedia capabilities using MOAP), I would like to know if there is a way to manupulate by script these controls (mini or standard). Although that there is also a 2 button control  (just the zoom and open in external browser) but they are hidden in the debug settings. It is interesting to view them by the way.  The question:  Is there is a way to know when a user clicked on the play button of the controls?

I want to change the texture color of a thumbnail button to green per example meaning that the user is currently hearing something and when s/he presses on stop, the color of the thumbnail button would change to normal.

2) I would like to know if there is any trick or I don't know something that does not oblige the user to click on the prim to activate it. It is so so so annoying to have a status prim that show the file (stream) that is currently playing using MOAP and URI sckeme methods and the user needs to guess that it should be clicked to view content.( I am using llSetText() to tell the user please click on the prim to which file are you playing)

The MOAP is cool but this precise  thing limits a lot its applications.

There were several complains of that annoying feature of MOAP under the form of bugs wich still "Unresolved"  from 2010 and that is strange

kindly seethe following links for clarifications:

https://jira.secondlife.com/browse/VWR-17719?page=com.atlassian.jira.plugin.system.issuetabpanels%3Achangehistory-tabpanel#issue-tabs

or

https://jira.secondlife.com/browse/VWR-23777?page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#issue-tabs

Any suggestion or clever trick to surpass that would be appreciated? i could not convince my client with my silly trick of llSetText()

3) My last question and I would like to thank you for your patience :) Please don't be bored :)

the following code is used in the majority of status prims that display text (telling user what type of file is she listnening to or what images smth like that)

The text look AWFULL on a prim of size as small as  <0.010,0.410,0.220> to be put on a Heads Up Display., I don t want to spend time on fancy CSS or HTML all I want is to clearly print a string like "Hello World!" and in the same I don't want scroll bars or weird loking text. I know that this is solved simply in CSS or HTML but I would like also kindly request your help on that minor issue.

 

//Author order of RedEagle

//Example taken from the wiki

integer face = 4;
string message;

default
{
    state_entry()
    {
        llSetPrimMediaParams(face,
            [
            PRIM_MEDIA_CURRENT_URL, "data:text/html," + message,
            PRIM_MEDIA_AUTO_PLAY,TRUE
                    ]);
    }

    on_rez(integer start_param)
    {
        llResetScript();
    }

    link_message( integer sender_num, integer num, string str, key id )
    {
        if(sender_num == 5)            //Audio is sending smth
        {
            message = "<html><font size='20'>" + str +  "</font></html>";
            llSetPrimMediaParams(face,
                [
                PRIM_MEDIA_CURRENT_URL, "data:text/html," + message,
                PRIM_MEDIA_AUTO_PLAY,TRUE
                        ]);


        }

    }

}

 

Thank you again for your time, patience  and help

 

Link to comment
Share on other sites

1) only the web page knows, but it can communicate back to the prim serving it to tell it so (or if it's served from the prim via http-in then the script could already know). PRIM_MEDIA_CONTROLS will allow you to control wether the bar is mini or standard

2) the only script thing you can do you are already doing.... setting autoplay to true. if the user has auto enabled it will play as soon as they are in range. you can also set a texture on the face with something that says "click me to play" for users that do not have autoplay enabled.

the only workaround currently to disable interaction with the viewed page is to limit interaction from within the page. a click block layer or div that is transparent should do the trick.

3) using AUTO_SCALE or Modifying WIDTH or HEIGHT for prim media params may get you what you need here... it gets complicated in some cases to figure out what the modifications are doing.... there is a scaling routine on the wiki you can use for this once you figure out the actual dimensions of the printed text and any default padding.

Link to comment
Share on other sites

Void Thank you so much for your answer. You always give me good ideas!!.  You 're genious!

I should maybe create a HTML5 or maybe AJAX. wrapper for my audio and video files and instead of relying on MOAP  controls that we can't add or remove anything to them. 

like per example a wrapper using URI scheme which uses the following HTML 5 code or an alteration of it is a lot powerfull than the controls of MOAP

//source: http://www.w3schools.com/html5/html5_audio.asp

<!DOCTYPE HTML>
<html>
<body>

<audio controls="controls">
  <source src="song.ogg" type="audio/ogg" />
  <source src="song.mp3" type="audio/mpeg" />
Your browser does not support the audio element.
</audio>

</body>
</html>

the outcome should be like this:

 

\

"The audio control in HTML 5 has the following:

  • Play
  • Pause
  • Seeking
  • Volume
  • Fullscreen toggle
  • Captions/Subtitles (when available)
  • Audio track (when available)" (source: W3School web site)

Maybe other web languages are more powerfull I did not search yet. I will try your method and see what I 'll get.

Thank you again Void for this illuminating answer

Link to comment
Share on other sites

You can make a http request to a php script which can obtain the owner key & name via the http headers, make the php script create a session and output the session key to be parsed by the in world script.

The script could then set the location of the shared media to the out of world php script containing the media player html, passing the session key obtained from the first php script via a get variable so that it knows which avatar is using the shared media. 

This would bode well for loading favourites or other user specific variables.

If you load the jquery javascript framework library within the html you can use its ajax get request to make a callback to the first php script which can record the users actions against their session.

You would then either have the in world object act as a web server or receive email from the php script or otherwise periodically request for updates from the first script regarding the users actions, fastest option would be preferable of course.

In world to out world communication is perfectly doable through shared media with php, mysql & ajax but I guess the question is, is it worth it?

Your looking at a very technical solution .. Good Luck

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4053 days.

Please take a moment to consider if this thread is worth bumping.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...