Play a video

Joined
Nov 26, 2017
Messages
39
Is there a way to show (play / stream) a video file on screen in desktop target? (mac)

Really nothing?
 
Last edited:
Joined
Nov 26, 2017
Messages
39
I'd like to ask this again. Maybe I'm too stupid to see a simple way here. Please help me out. How to play/show a video file in Cerberus?
 

dawlane

Well-known member
CX Code Contributor
Tutorial Author
Joined
Jun 21, 2017
Messages
937
There is no simple way. For Cerberus to play a video file, a custom module would have to be written to use OpenGL and a video codedec.
 

Wingnut

Well-known member
3rd Party Module Dev
Tutorial Author
Joined
Jan 2, 2020
Messages
1,196
There's at least a video module for HTML5 already made, maybe this can be useful to you.
 

SLotman

Active member
3rd Party Module Dev
Tutorial Author
Joined
Jul 3, 2017
Messages
217
Ages ago I did this on BlitzMax, using MCI calls and FindWindow/SetWindowParent API. Used to work well until windows 8 - but I tried running it right before posting this on Windows 10 and it failed on fullscreen (worked on windowed mode though).

I have no clue how to do it on Macs, but on Windows playing video inside OpenGL was always a mess. Maybe under Direct-X was easier, having DirectShow - but I never used it and I don't even know if thats still supported :/

Edit: Wow, it actually works, just not on the default DX7 driver of Blitzmax. Using OpenGL or DX9 the video plays just fine :)
 
Last edited:

Wingnut

Well-known member
3rd Party Module Dev
Tutorial Author
Joined
Jan 2, 2020
Messages
1,196
Nice, do you think it would work for Cerberus-x too?
 

SLotman

Active member
3rd Party Module Dev
Tutorial Author
Joined
Jul 3, 2017
Messages
217
In theory it should, yes. Just a small C file making MCI calls. But it would only work on windows/desktop target.
 

Phil7

Administrator
CX Code Contributor
3rd Party Tool Dev
Joined
Jun 26, 2017
Messages
698
I did some tests on windows with a C library called PL_MPEG that can deal with mpeg1 videos. So far it looks promising at least on Windows.
1665933683418.png
 

Wingnut

Well-known member
3rd Party Module Dev
Tutorial Author
Joined
Jan 2, 2020
Messages
1,196
I did some tests on windows with a C library called PL_MPEG that can deal with mpeg1 videos. So far it looks promising at least on Windows.
View attachment 1471
Nice. Care to share some sourcecode? I would really love to see how to code Cerberus-x extensions in Windows.
Did you use Visual Studio some other package/compiler?
 

Phil7

Administrator
CX Code Contributor
3rd Party Tool Dev
Joined
Jun 26, 2017
Messages
698
Care to share some sourcecode?
Sure, it's just not ready yet and really ugly. So that's my approach oftentimes. Get it to a working state and then think about the structure. 😝
I am using the gcc compiler as it is configured with Cerberus and see how far I get with just wrapping some of the native functions.
If I am unsure how the api works I build the example codes as described on their github page and modify it to see what is going on.
There are some things with coupling native code to cerberus that I figure out by just looking at the transpiled code. My plan is to make a tutorial or at least a list of some useful tidbits I am using.
 

Wingnut

Well-known member
3rd Party Module Dev
Tutorial Author
Joined
Jan 2, 2020
Messages
1,196
That sounds promising! I was about to make some tutorial how to make HTML5 extensions but it takes some time. I was loosing time rying to make Cerberus access fileaccess system so I started to look around for other packages but noone seemed as nice as Cerberus so then I thought..let's try to mix and make extensions.
 

SLotman

Active member
3rd Party Module Dev
Tutorial Author
Joined
Jul 3, 2017
Messages
217
HTML5 is the easiest to make stuff for. For example, I have a small routine to get the browser language:


Code:
#If TARGET="html5"

    Extern
        Function getLanguage:String() = "function (){ return navigator.userLanguage || navigator.language; }"
    Public

#End


That's it! You can now use "getLanguage" and it will return the language string from the browser :)
 
Top Bottom