Jump to content

Youtube video on a prim: disable youtube links


testgenord1
 Share

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

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

Recommended Posts

Hi!
I would like to build a prim presenting a streaming Youtube video.
This, as such, is easy.
However, I would like to arrange the video in such a way that, once the video has started, the person watching it cannot click on the other video links in the browser,
i.e. he/she only has the option to watch this one video, or no video at all.

I've tried several methods, but they all have the same problem,
which lies in the fact that the video must be started by clicking on the screen once,
or otherwise you cannot watch at all.
If you allow that, you automatically allow clicking on other videos, too.

I cannot seem to find a work-around solution.

The only hack solultion I could come up with is to rez an alpha screen-sized object in front of the screen after a few seconds,
stopping the person watching from clicking the screen,
but this is quite clumsy.

Do you have any idea how this could be done?

Here's the script I've tried, it works in general, but, with the problem described above:

default
{
    touch_start(integer num)
    {
         llSetLinkMedia( 0, 1,  [PRIM_MEDIA_CURRENT_URL,"www.youtube.com/watch?v=...",
         PRIM_MEDIA_AUTO_PLAY,TRUE]);
    }
}

Thank you very much in advance.

Link to comment
Share on other sites

Ah, yes. I remember having to script a solution to that one a long time ago, now that you mention it. As I recall, I did a version of the trick you suggested yourself, pushing a transparent prim out to cover the screen as soon as it's touched and only retracting it after the video has stopped. It feels clumsy, but doesn't have to be.

Link to comment
Share on other sites

In order to clear the screen after finishing the video, I tried LlClearLinkMedia,
but after that the video could not be started again.

Hence, the only work-around I could come up with is to auto-delete the entire Prim after some time
and have it rezzed again through clicking a button.
After rezzing, there is going to be a transparent screen in front of it to block users from clicking links on the webpage.

I'm really not satisfied with this, so if anyone has a more elegant solution, please let me know.
Thanks!

Link to comment
Share on other sites

applications (LSL included) can do what the YouTube IFrame Player API allows

reference is here: https://developers.google.com/youtube/player_parameters#IFrame_Player_API

LSL only allows url parameters which conform with the Youtube API

as you mention the only way to prevent our user from interacting with the YouTube player surface is to cover it with a transparent face of another prim.  A TV cabinet for example with the Youtube surface embedded behind the TV cabinet glass face

as OP code snippet indicates llSetLinkMedia() is being used, so the object appears to have more than one prim already. In which case a way is to add TV controls to the cabinet (and/or a TV remote control device), then send our control commands to Youtube as url api parameters via LLSetLinkMedia

 

edit ps.  On the question: Can our application thru the API remove links from a Youtube video. The answer is No, as the links in a video are deemed by YouTube to be content. And we can't programmatically remove content inserted by the creator

we can remove content as individuals by using our browser settings. LSL does not allow us to take control of another resident's browser

Edited by Mollymews
Link to comment
Share on other sites

One "simple" solution could be to host your own site that's just a blank page with some JavaScript code in it. It's like one line of code.

  1. When someone gives your LSL script a link, the script parses that link so that it only extracts the unique part for the video, eg.
  2. https://www.youtube.com/watch?v=tv1k0Z2qCHI becomes  tv1k0Z2qCHI
  3. Then your script sets media using your page URL, with the JavaScript, eg.
  4. mypage.com/tv1k0Z2qCHI

Then, that page is totally empty except for the JavaScript that has the information in the URL. It can then add an iframe to the empty page, embedding the requested video. The embed options also allow hiding any related videos so people can't change the video after it ends.

Since JavaScript runs on each client directly, this doesn't even require any bandwidth (only enough to send the JS code) from your site, even with heavy usage. Even free web hosting options will easily handle this, as long as they allow JS.

Edited by Wulfie Reanimator
  • Like 3
Link to comment
Share on other sites

12 hours ago, Wulfie Reanimator said:

The embed options also allow hiding any related videos so people can't change the video after it ends.

this used to be the case prior to September 2018. The YouTube 'rel' parameter when set to '0' no longer disables the show related videos page at the end. '0' now shows related videos from the same channel when there are related videos

i like the idea tho of hosting our own passthru service as this gives access to other Youtube APIs: Analytics, Data, Live and Reporting on our own host

Link to comment
Share on other sites

Hi again!
Sorry about the late reply, but I've only found time today to check again.
It looks as though the Youtube settings combined with the prim texture media settings are sufficient.
Here are some ideas I've got from somebody on OSGrid (djphil):

Quote

First we do not display the normal page but we use the page "embed" instead of the normal page.
This has already avoided a lot of possibility of clicking on other links/videos.
Normal url exemple: https://www.youtube.com/watch?v=kx1OVSsL7IM
Embed url exemple: https://www.youtube.com/embed/kx1OVSsL7IM

[Then we have to start the video ...
Again we use a trick, we pass the autoplay parameter in GET like this ?autoplay=true
Normal url exemple: https://www.youtube.com/watch?v=kx1OVSs ... oplay=true
Embed url exemple: https://www.youtube.com/embed/kx1OVSsL7IM?autoplay=true ]    <-- This can probably also be achieved through the prim texture media settings.

But there are still videos down when you stop the video or if the video has arrived at the end.
In this case we must pass an additional parameter in the url of the video.
Before ?rel=0 was enough to delete it completely but now it does not work anymore.
Now ?rel=0 simply replaces the vidoes with your videos playlist only.
Embed url exemple: https://www.youtube.com/embed/kx1OVSsL7 ... true&rel=0

[We also have the option to specify a playlist with ?listType=playlist&list=<PLAYLIST_ID>
You can now display a playlist of a channel instead of related videos.]    <-- I ended up not needing this.

To pass several parameters in the url, respect the following syntax:
?param1=value1&param2=value2&param3=value3 ...
Note the first separator is ? and then for all others it's &

In addition, I changed some of the settings in the "texture" tab of the prim (Singularity Viewer):
Edit - select face - texture - Media - Choose - Customize - *uncheck* show control bar
- Security - *check* Only allow Access to specified URL patterns - Add - *paste URL from 'General' tab* - OK

This seems to work.
No other links have been accessible so far and no scripts were necessary.
If you have more ideas or still see some problems, feel free to comment.

Thank you very much for your help, once again!

Edited by testgenord1
  • Like 2
Link to comment
Share on other sites

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

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...