Page 1 of 1

How to stop widget browser after youtube movie

Posted: Fri Oct 27, 2017 12:47 pm
by sphere
Hi,

i was wondering how to stop the widget"browser" from loading a page after playing a youtube movie.

Youtube always shows a bunch of suggestions after a movie/clip ends.
How can you detect this and make the browser invisible? (the last part i know)

So i have a fixed list of which the user can choose from, but i don't want the browser acting as a browser ones the movie is finished.

So i have the chosen url in a variable and then:
set the URL of widget"clipinbrows" to tClipUrl

this works great on mobile, now how do i detect the end of the clip/movie?

thanks for any help.

Re: How to stop widget browser after youtube movie

Posted: Sun Oct 29, 2017 1:19 am
by [-hh]
There are javascript solutions to do that, see for example
https://stackoverflow.com/questions/214 ... ne-playing

So you could use one of these and use a javascriptHandler to get informed.

Re: How to stop widget browser after youtube movie

Posted: Sun Oct 29, 2017 10:16 am
by sphere
Thanks, i will have to do some learning on how to do that.

So this ' browserDocumentLoadComplete pUrl ' which you can use in the widgets script would not be appropriate for this?

Re: How to stop widget browser after youtube movie

Posted: Sun Oct 29, 2017 11:17 am
by [-hh]
No, usually loading should be a bit in advance of playing ("buffer"), also you can load without playing.

You could start with how to pause/start/stop an audio in the browser, in your case the widget, from LiveCode. Then go step by step to your scenario, finally using an event listener (see the stackoverflow answer linked to above).

Here is a starting point, a tutorial for a HTML5 standalone.
It is the same for a browser widget. And it is the same for a <video> element as for an <audio> element.

Instead of      do tScript as "JavaScript"
you write       do tScript in widget "Browser"

The HTML file in the tutorial is the htmltext of your browser widget.

http://lessons.livecode.com/m/4071/l/74 ... s-in-html5

Re: How to stop widget browser after youtube movie

Posted: Sun Oct 29, 2017 4:20 pm
by sphere
Thanks a lot!

I was thinking where do i put this script? but i can just put in a field or file and then put it in a variable.
Then use the command as you described.

I will do some testing and report back.

Re: How to stop widget browser after youtube movie

Posted: Sun Oct 29, 2017 4:29 pm
by [-hh]
Don't forget that tScript (the javascript) has to be ONE line only, separate commands by "; " instead of CR.

Re: How to stop widget browser after youtube movie

Posted: Sun Oct 29, 2017 5:05 pm
by jacque
You might try this, which doesn't require javascript:

https://stackoverflow.com/questions/363 ... embed-code

Re: How to stop widget browser after youtube movie

Posted: Sun Oct 29, 2017 6:45 pm
by sphere
Thanks, that will be a long line of script then ;)

Thanks for the link Jaqcue,

Other parameters https://developers.google.com/youtube/player_parameters i

after all it is ?rel=0 behind the embed url

(in joomla too extra parameters is first with ? sign )

Great ! works now. No related videos, just the same which was playing, you can loop it too :) &loop=1 behind it.

So you get like:
https://www.youtube.com/embed/aOyYhccJHVw?rel=0&loop=1

Re: How to stop widget browser after youtube movie

Posted: Sun Oct 29, 2017 7:44 pm
by [-hh]
This solution has nothing to do with LiveCode, is simple HTML only.
Your original question was how to make the widget stop after playing a movie?!

So, good for you, but wasted time for me. I better stop answering such questions ... ;-)

Re: How to stop widget browser after youtube movie

Posted: Sun Oct 29, 2017 9:41 pm
by sphere
Yes the question is correct, but it don't matter how it is solved.
Any solution will do, and the easy ones(or the ones who work the best) are the best.

I do appologize if it was different for you, I really do appreciate your help and from others too a lot ! :D
And if i can help others with solutions i will do so too.

I did in my question not expect that it could be solved that way, but that the browser itself had to detect it somehow.

Schone feierabend noch!

Re: How to stop widget browser after youtube movie

Posted: Tue Feb 06, 2018 10:20 am
by sphere
Probably Hermann's suggestions are going to be of big help
http://forums.livecode.com/viewtopic.php?f=53&t=30575
After all he is the Master of the Browser Widget :)

Difficult for me but let's try.