How to stop widget browser after youtube movie

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

How to stop widget browser after youtube movie

Post by sphere » Fri Oct 27, 2017 12:47 pm

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.

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: How to stop widget browser after youtube movie

Post by [-hh] » Sun Oct 29, 2017 1:19 am

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.
shiftLock happens

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: How to stop widget browser after youtube movie

Post by sphere » Sun Oct 29, 2017 10:16 am

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?

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: How to stop widget browser after youtube movie

Post by [-hh] » Sun Oct 29, 2017 11:17 am

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
shiftLock happens

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: How to stop widget browser after youtube movie

Post by sphere » Sun Oct 29, 2017 4:20 pm

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.

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: How to stop widget browser after youtube movie

Post by [-hh] » Sun Oct 29, 2017 4:29 pm

Don't forget that tScript (the javascript) has to be ONE line only, separate commands by "; " instead of CR.
shiftLock happens

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: How to stop widget browser after youtube movie

Post by jacque » Sun Oct 29, 2017 5:05 pm

You might try this, which doesn't require javascript:

https://stackoverflow.com/questions/363 ... embed-code
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: How to stop widget browser after youtube movie

Post by sphere » Sun Oct 29, 2017 6:45 pm

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

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: How to stop widget browser after youtube movie

Post by [-hh] » Sun Oct 29, 2017 7:44 pm

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 ... ;-)
shiftLock happens

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: How to stop widget browser after youtube movie

Post by sphere » Sun Oct 29, 2017 9:41 pm

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!

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: How to stop widget browser after youtube movie

Post by sphere » Tue Feb 06, 2018 10:20 am

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.

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”