Embed YouTube Video On A Screen?

BlitzMax Forums/BlitzMax Programming/Embed YouTube Video On A Screen?

MGE(Posted 2008) [#1]
Is this even possible, if so... how? Thanks.


Beaker(Posted 2008) [#2]
You would either have to embed html in a html gadget using MaxGUI (or similar), or download the video (FLV) and play it using embedded Flash somehow. Both are possible.


MGE(Posted 2008) [#3]
Thanks Beaker. hmm... don't use MaxGui, I wonder if there is a 3rd party gadget for this?


AlexO(Posted 2008) [#4]
gameswf may be useful.

Except it's C++....
It's 'pre-alpha' code...
...And it only works in OpenGL (win/mac/linux).

Not much, but could be worth trying to wrap it for max if it actually does basic flash video (which the update mentions).


MGE(Posted 2008) [#5]
Thanks, I was thinking of embedding youtube vids in an upcoming project for tutorial purposes without having to include them in the dsitribution or hosting them on my site. hmm...


skidracer(Posted 2015) [#6]
' createhtmlview.bmx

Import MaxGui.Drivers

Strict 

Local window:TGadget
Local htmlview:TGadget

window=CreateWindow("My Window",30,20,600,440,,15|WINDOW_ACCEPTFILES)

htmlview=CreateHTMLView(0,0,ClientWidth(window),ClientHeight(window),window)
SetGadgetLayout htmlview,1,1,1,1 

HtmlViewGo htmlview,"www.youtube.com"

While WaitEvent()
	Print CurrentEvent.ToString()
	Select EventID()
		Case EVENT_WINDOWCLOSE
			End
	End Select
Wend



eek, no adblock! hmm, jscript crashed after i clicked on a movie


Derron(Posted 2015) [#7]
@skid
Did you think about extracting the video url and creating a "local" website embedding that video?
Or just embed a specific "iframe" (like if you embed a video in your board/website).
This would get rid of the "surroundings" of a video in a default youtube video page.

Also you should check if the returned code is for html5 and not flash videos.


PS: your code draws this:
Error - File not found

Unable to find the file at www.youtube.com



Edit:

... does NOT work for me but uses the iframe approach. When calling opening the html file in the browser it tries to load a flash video - even with html5 param... hmpf. But maybe it helps.


bye
Ron


skidracer(Posted 2015) [#8]
what platform are you on?


Derron(Posted 2015) [#9]
Linux

I edited something into my previous post.


bye
Ron


skidracer(Posted 2015) [#10]
the following url should give you a nice full window youtube video

http://www.youtube.com/v/IEIWdEDFlQY

with win32maxguiex driver it throws a Windows exception EXCEPTION_ACCESS_VOLATION, which it may do with all flash content these days :(


Derron(Posted 2015) [#11]
Not on my linux box (64bit):

for
HtmlViewGo htmlview,"https::www.youtube.com/v/IEIWdEDFlQY"


Same for "https://www..."

Of course it shows a big video when opening the url in the real chrome/ff.


@64bit
Means I do not have the webkit or mozilla webview but a more basic one (see the discussion about it in the "InDevIDE"-thread)

bye
Ron


skidracer(Posted 2015) [#12]
I doubt any of the drivers recognise the https form


Derron(Posted 2015) [#13]
What should happen when I click on it?

GadgetAction: data=0, mods=0, x=0, y=0, extra="https://www.youtube.com/v/IEIWdEDFlQY"


But nothing more.

bye
Ron


skidracer(Posted 2015) [#14]
I mean in your linux browser (here=the link i posted above), not from blitzmax program.


Derron(Posted 2015) [#15]

Same for "https://www..."

Of course it shows a big video when opening the url in the real chrome/ff.




bye
Ron


skidracer(Posted 2015) [#16]
[grabs macbook]

is there an html5 parameter for /v/ format ?


Brucey(Posted 2015) [#17]
My (unreleased/wip) CEF module can do this. I've had it playing youtube videos on a Max2D screen... if you like that kind of thing.


Derron(Posted 2015) [#18]
the html5 param got removed - but some users mention it to still work.

Seems the "browser" you are using should emit somehow that it understands html5 or set "html5 = true" for youtube (like if you do that manually when visiting youtube.com).

Edit: I tried it on my xubuntu 12.04 32bit - same output as on my local 64bit machine (and nothing happening when clicking on it).


Feel free to send me your linux binary to test it:
ron@...

bye
Ron


skidracer(Posted 2015) [#19]
cocoaMaxgui

www.youtube.com yes
http://www.youtube.com yes
https://www.youtube.com no
/v/ format no

win32MaxguiEx

www.youtube.com unstable
http://www.youtube.com unstable
https://www.youtube.com no
/v/ format no


I think the unstable win32 stuff can be addressed with silencing the script error handler