Asset - Extension Video Player (for Windows, macOS, and Ubuntu)

  • Thread starter Sam (Deleted User)
  • Start date
Status
Not open for further replies.
S

Sam (Deleted User)

Guest



Supports 32-bit Windows, macOS, and 32-bit GMS 1.4 / 64-bit GMS 2 Ubuntu.

For 64-bit Windows support and to support development, see Video Player Pro.

Pros: Free. Open Source. Permissive MIT License. Cross-Platform for Desktop.

Cons: Can not Render to a Texture. Fills Game Window only. No Drawing over.

Add me on Discord to get faster support than email: Samuel Venable#5465

Special thanks to YellowAfterlife for the asset icon!

Download Free for GameMaker Studio 2.2, 2.3 (Marketplace)
Download Free for GameMaker Studio 1.4, 2.2, 2.3 (itch.io)


Functions included:
C++:
// GameMaker 8.1 splashvideo functions
void splash_set_stop_mouse(bool stop);
void splash_set_stop_key(bool stop);
void splash_show_video(std::string fname, bool loop);

// GM extension video playback functions
void splash_set_window(std::string wid);
void splash_set_volume(int vol);
std::string video_add(std::string fname);
bool video_get_option_was_set(std::string ind, std::string option);
std::string video_get_option_string(std::string ind, std::string option);
void video_set_option_string(std::string ind, std::string option, std::string value);
void video_play(std::string ind);
bool video_is_paused(std::string ind);
bool video_is_playing(std::string ind);
int video_get_volume_percent(std::string ind);
void video_set_volume_percent(std::string ind, int volume);
std::string video_get_window_identifier(std::string ind);
void video_set_window_identifier(std::string ind, std::string wid);
void video_pause(std::string ind);
void video_stop(std::string ind);
unsigned video_get_width(std::string ind);
unsigned video_get_height(std::string ind);
double video_get_position(std::string ind);
double video_get_duration(std::string ind);
bool video_exists(std::string ind);
void video_delete(std::string ind);
std::string window_identifier();
Have fun boys,
Samuel
 
Last edited by a moderator:

chamaeleon

Member
This bypasses the GPL license of mpv media player because I am posting to the command line program's website which gives the source and I am not linking to any library statically nor dynamically with this extension, I am running the application from the command line, which means you don't have to share the source of your games because due to not linking to anything you're off the hook with the GPL, so congrats.
My understanding of GPL is if you distribute a compiled program you are also responsible for ensuring access to the GPL source either by including it or including documentation that states how to access it, and the access must be provided by you, and not depend on the original authors and their means of distributing it. This includes your distribution, as well as anyone distributing a game based on your extension.
 
S

Sam (Deleted User)

Guest
My understanding of GPL is if you distribute a compiled program you are also responsible for ensuring access to the GPL source either by including it or including documentation that states how to access it, and the access must be provided by you, and not depend on the original authors and their means of distributing it. This includes your distribution, as well as anyone distributing a game based on your extension.
That is incorrect, you need to be actually linking to the code for your game to be affected by this at all. I'm going to ask the person I got this information to give a better and more direct explanation. If I am able to prove what I said is true, I'm going to request a moderator to remove your post for spreading false infomation.

You have good intentions, but I don't want people to be too scared to download my extension if you happen to be misinformed. I could very well be myself, so that's why I'm clarifying with someone who is well versed in these kind of legal matters for clarification.

I hope I didn't come across rude, I was just excited about this extension release and it looks like based on what you said crap already hit the fan, lol

I hope this gets sorted out and I hear back from them soon. I didn't think this was an issue.
 
Last edited by a moderator:

chamaeleon

Member
That is incorrect, you need to be actually linking to the code for your game to be affected by this at all. I'm going to ask the person I got this information to give a better and more direct explanation. If I am able to prove what I said is true, I'm going to request a moderator to remove your post for spreading false infomation.

You have good intentions, but I don't want people to be too scared to download my extension if you happen to be misinformed. I could very well be myself, so that's why I'm clarifying with someone who is well versed in these kind of legal matters for clarification.

I hope I didn't come across rude, I was just excited about this extension release and it looks like based on what you said crap already hit the fan, lol
You are distributing a linked executable, mpv.exe. This is the executable whose code you or users of your extension need to distribute, not the code for whatever game uses it. I should have been more clear about that.
 
S

Sam (Deleted User)

Guest
You are distributing a linked executable, mpv.exe. This is the executable whose code you or users of your extension need to distribute, not the code for whatever game uses it.
Ah, few, ok good. Thank you so much for the clarification! :D I'm quick to hit the panic button. So if that is the case, i assume i need to make it available with the asset itself? I can just put it in a zip under included files, and then I'm ok?

If that is sufficient I'm going to publish the update ASAP. Thank you so much for keeping me out of trouble! lol
 

chamaeleon

Member
Ah, few, ok good. Thank you so much for the clarification! :D I'm quick to hit the panic button. So if that is the case, i assume i need to make it available with the asset itself? I can just put it in a zip under included files, and then I'm ok?
That is my understanding, yes, it would satisfy the GPL to the letter, and users of your extension would be covered if they did the exact same thing with it.

Edit: IANAL ... :)
 
S

Sam (Deleted User)

Guest
Yay, ok, so I updated the asset and its description:

When exporting your game please do not delete mpv-master.zip from your game distribution to comply with GPL. This also goes for when distributing the source of your game if you want your game source to be accessible to your development team or whoever, you are not authorized to delete the source of mpv media player found in the mpv-master.zip file when distributing the binary mpv.exe and mpv.com files. On Linux this isn't an issue because when you install mpv from your package manager the source code should be downloaded with it if the package manager is to comply with GPL, which it probably does.
 

FoxyOfJungle

Kazan Games
This is very cool! (like everything you do) Do you have a reason that this runs slowly in fullscreen? I think I could use this on a Launcher that I'm doing, but the fact that it is fullscreen and playing the video slowly can get in the way. Thank you for making it free. :)
 
S

Sam (Deleted User)

Guest
This is very cool! (like everything you do) Do you have a reason that this runs slowly in fullscreen? I think I could use this on a Launcher that I'm doing, but the fact that it is fullscreen and playing the video slowly can get in the way. Thank you for making it free. :)
I'm in the process of replacing the version of the extension that runs on Windows to use the DirectShow API instead of mpv media player which should help fix that. Or is this happening on Linux?
 

FoxyOfJungle

Kazan Games
I'm in the process of replacing the version of the extension that runs on Windows to use the DirectShow API instead of mpv media player which should help fix that. Or is this happening on Linux?
It is a good idea, especially if you do not necessarily need to depend on a third party license, having to keep a copy of "unnecessary" files. I don't have Linux, only Windows by the way. I don't remember how Game Maker 8 used to play videos, but it still works amazingly today 🤔, his only weakness is that he is very limited because he doesn't have controls or can't draw anything over the top. (GM 8)
 
S

Sam (Deleted User)

Guest
It is a good idea, especially if you do not necessarily need to depend on a third party license, having to keep a copy of "unnecessary" files. I don't have Linux, only Windows by the way. I don't remember how Game Maker 8 used to play videos, but it still works amazingly today 🤔, his only weakness is that he is very limited because he doesn't have controls or can't draw anything over the top. (GM 8)
GameMaker 8.1 used DirectShow - the same thing this extension uses, as of right now. :D

GMS2 - Version 1.2.1. Published August 13, 2020
  • No longer uses mpv media player on Windows. Still does on Linux.
 
S

Sam (Deleted User)

Guest
well done, great job.
Also thank you for video player source code too.
very handy.
You're welcome!

The next update will include error printing when run from command prompt on Windows to show the exact line and function in the source that failed and the error description to help users debug the problem if their video doesn't play. This might be added on Linux as well as I'm very certain mpv media player already does this or something similar on its own, so it would just be a matter of capturing the output from the mpv executable and redirecting that to print in the terminal from the parent process.
 
S

Sam (Deleted User)

Guest
That's a nice feature to have, I can't wait to test it.
keep up the good work.
The update has been published. It is only added to Windows at the moment. I figured it would be better to have it show graphical errors instead of silent printing so it you won't be required to run from the terminal when something has gone wrong to find out why. Also video_stop() and video_delete() now work properly so you are able to call them in any event, not just game end. Which means you can now skip videos properly.

Edit:

I spoke too soon. While video_stop() works fine, video_delete() is still having issues. In most cases, you shouldn't really need to use video_delete() anyway, so it's not a huge problem. I can't think of a time where it's truly necessary to use that function, to be honest. It's a Windows-only issue.

Edit2:

Ok, I just publish 1.7.0 which I'm certain has fixed the video_delete() segfault problem on Windows.

Edit3:

Just published 1.8.1 and this is the most rock-solid stable it has been thus far on Windows. There aren't any more bugs I can find currently, I'm pretty sure I fixed all that was left. If I happen to be wrong and anyone finds a bug of some kind they'd like to file a report for or would like to contribute, both may be done on GitHub over at the official repository for the extension: https://github.com/time-killer-games/libvidplayer
 
Last edited by a moderator:
O

omid ghotbi (TAO)

Guest
Great job dude, I will try it and see how it goes. Also, it would be perfect to have a direct notifications, logs and messages for debugging and feedback inside Gamemaker. it should not be so hard to add this kind of logs, I already did that in the android video player and it was pretty easy.
in java it's like :
Java:
int dsMapIndex = RunnerJNILib.jCreateDsMap(null, null, null);
RunnerJNILib.DsMapAddString(dsMapIndex, "type", "video_completed");
RunnerJNILib.CreateAsynEventWithDSMap(dsMapIndex, EVENT_OTHER_SOCIAL);
Log.i("yoyo","Video_onVideoCompleted ");
 
S

Sam (Deleted User)

Guest
Great job dude, I will try it and see how it goes. Also, it would be perfect to have a direct notifications, logs and messages for debugging and feedback inside Gamemaker. it should not be so hard to add this kind of logs, I already did that in the android video player and it was pretty easy.
in java it's like :
Java:
int dsMapIndex = RunnerJNILib.jCreateDsMap(null, null, null);
RunnerJNILib.DsMapAddString(dsMapIndex, "type", "video_completed");
RunnerJNILib.CreateAsynEventWithDSMap(dsMapIndex, EVENT_OTHER_SOCIAL);
Log.i("yoyo","Video_onVideoCompleted ");
Sure, I'll have a look at it and see what I can do.

It's worth mentioning, since you have been working on a video player as well, you are free to create your own version of my extension and adapt it to match your extension's exact API, and closed-source / sell it if you like, since I intentionally licensed the extension permissively.
 
O

omid ghotbi (TAO)

Guest
Thanks, dude, I can send you my video player extension if you are interested in.
It's a video player that can play ads after finish the video (optionally).
of course, it's in java and objective C and works for android and ios.
 
Last edited by a moderator:
S

Sam (Deleted User)

Guest
I don't develop mobile extensions, while I do know Objective C thanks to Mac, mainly because I don't have an iOS device I can't do that one, and in the case of Android I'm not a fan of Java.

Thanks for the kind offer though.

Edit:

The extension has been ported to GameMaker 8.1. Download link in the OP.

Edit2:

Ok, so on Linux the video player steals window focus so the game window can only receive keyboard input when you click the title bar or border to give the parent window focus I can't seem to find a way around that. You can't skip the video from keyboard input unless the parent window has focus by clicking the window border or title bar. Normally you could cheat your way around this by using keyboard_check_direct() but that seems to not work on Linux for this purpose. The parent window still needs focus, rending keyboard_check_direct() useless. Might be a GM bug.

So I was wondering to make it seamlessly cross-platform should I adopt this behavior on Windows? I can just do that by removing the child window style from the video, then it will behave exactly the same as it does on Linux, except the parent window will have its border and title bar grayed out from the lack of focus, and I'm not sure why Windows does this but Linux doesn't. I thought they both did that Windows behavior.
 
Last edited by a moderator:
S

Sam (Deleted User)

Guest
Switched to using libmpv instead of DirectShow on Windows. No longer uses command line mpv on Linux and FreeBSD. Mac support will be added soon. Now supports all video formats supported by ffmpeg on all supported platforms. mpv media player (the command line version) is GPL however libmpv (the client library) is LGPL and 1) I have not modified the binary's original source code and 2) I'm not statically linking it, so there are not as many restrictions now as there were with the command line program version. Please let me know if I am wrong.
 
Last edited by a moderator:

Josepho

Member
You are awesome! there wasnt any functional mac video support at the moment, or at least i wasnt able to find it

I tried to download the extension from your link and it says the link is broken :(
 
Last edited:

Josepho

Member
Thanks, dude, I can send you my video player extension if you are interested in.
It's a video player that can play ads after finish the video (optionally).
of course, it's in java and objective C and works for android and ios.
Do you have the extension for sale?
 
S

Sam (Deleted User)

Guest
You are awesome! there wasnt any functional mac video support at the moment, or at least i wasnt able to find it

I tried to download the extension from your link and it says the link is broken :(
I was updating the links around the time you must've tried it, I'd try it again. I'm not paying apple to codesign my stuff because everything I do is free and open source. Please add me on discord if you run into trouble. Right now I'm relying on installing files via homebrew but since homebrew doesn't install anything codesigned it might not work for people who do codesign so I'll need a tester to verify how this works.

If that doesn't end up working out I have a backup plan to fallback on that doesnt involve using homebrew but requires me hosting my extension not on the marketplace anymore because the file size will be too big again. :/
 

Josepho

Member
I was updating the links around the time you must've tried it, I'd try it again. I'm not paying apple to codesign my stuff because everything I do is free and open source. Please add me on discord if you run into trouble. Right now I'm relying on installing files via homebrew but since homebrew doesn't install anything codesigned it might not work for people who do codesign so I'll need a tester to verify how this works.

If that doesn't end up working out I have a backup plan to fallback on that doesnt involve using homebrew but requires me hosting my extension not on the marketplace anymore because the file size will be too big again. :/
At this point i cant find the link lol, i guess you removed it. I already sent you an invitation to your discord if you need a mac tester i can help :)
 
S

Sam (Deleted User)

Guest
I can't make use of this info for this particular asset because of the upload file size limit, but for everyone else who would like to know early on:

BTW - If you have the 64bit DLL sitting beside the 32bit one and call it (assuming 32 bit one is called <name>.dll) <name>_x64.dll then the Runner should find the 64bit one after the 32bit one fails to load.

I have not checked the manual but I did provide the info to Mark so it should be in the manual for 2.3.1

Russell
@Sybok @YellowAfterlife @zbox and please whoever else I missed who makes extesions that could be tagged here
 
Last edited by a moderator:
S

Sam (Deleted User)

Guest
Just wanted to point out to everyone the video_* functions unlike the splash_* are asynchronous and can play audio as well not just video files, and much like the video files it supports pretty much any audio format you can think of thanks to mostly ffmpeg and it even can load and play midi files surprisingly even though ffmpeg which libmpv is based on can't play those libmpv took the extra mile to add support for midis and best of all this is cross-platform as well.
 

FoxyOfJungle

Kazan Games
For people who want the latest versions of my extensions, the marketplace updater is having problems for me again, please go to itch:


I recently updated my video player and dialog module over there at the above link. The update contains important bug fixes.
Hi, I noticed that you changed the name of the dlls to libfilesystem.dll and libdlgmod.dll. This is perfect! This makes it more discreet when exporting the project in .zip. If everyone who made extensions did that, it would be great. Thank you so much for your amazing work!
 
S

Sam (Deleted User)

Guest
- Added support for playing videos from URL's, (not just local files), via youtube-dl. Same goes for my Video Player Pro asset.

End users will need to update their youtube-dl installation to the latest every once in a while using their package manager in case a patch has been released.

Developers targeting Windows may do this for the user automatically by doing the following with their filesystem sandbox off:
GML:
http_get_file("https://yt-dl.org/latest/youtube-dl.exe", working_directory + "youtube-dl.exe");
 
Last edited by a moderator:
S

Sam (Deleted User)

Guest

some of you might've noticed I took my video player down.

due to legal issues

i had to change to exclusively WebM format.

and plus, this supports rendering to a surface.

with a large amount of help and thanks to nik krapivin.

will be available after i added audio and time calculations support.

or nik, whoever figures it out first.

Early access to library source, and test gm projects will be available soon


Ok, early access GMS 2.3.1 project here:


I still need to build for 64-bit windows runtime, macOS, and raspberry pi. Windows 32-bit and Linux are included in this version.
 
Last edited by a moderator:
S

Sam (Deleted User)

Guest
Wonderful! Thank you!
The question is, is it possible to improve the performance of this solution? Displaying 1080p video is about 30 fps on my not-so-weak computer.
I've been asking yellowafterlife for help, he understands a way that can help performance, but he is probably either wanting me to do research on his approach so I learn how to do it myself or he is too busy to make a pull request or explain to me more in detail how to make it faster. I'll let you know if/when that gets resolved.

Edit: were posts removed from this topic I didn't see when offline? I got a message from someone that made little sense to me but would make more sense if something like this happened that would give it context. Thanks!

Edit2: finished porting it to all intended platforms. Uploading now to the marketplace and itch.io
 
Last edited by a moderator:

UsagiDood

Member
Hello! I have been roaming around forums for a huge while, looking for video players, and fell on your addon page yesterday! Problem is, I still only use GMS 1.4 and noticed that your addon collection page is for 2.3+ only. Was the 1.4 version completely taken down?
 
S

Sam (Deleted User)

Guest
Hello! I have been roaming around forums for a huge while, looking for video players, and fell on your addon page yesterday! Problem is, I still only use GMS 1.4 and noticed that your addon collection page is for 2.3+ only. Was the 1.4 version completely taken down?
I have several people who requested help from me that are ahead of you at the moment. You and two other users caught me in the middle of finishing up something ive been working on. I can send you a gms 1.4 version as soon as I can with those other things taken care of first.
 

UsagiDood

Member
I have several people who requested help from me that are ahead of you at the moment. You and two other users caught me in the middle of finishing up something ive been working on. I can send you a gms 1.4 version as soon as I can with those other things taken care of first.
Hey, thanks for the quick reply! I can definitely wait as much as needed, no worries about that. Glad to know the 1.4 version still exists! 😄
 
S

Sam (Deleted User)

Guest
Hey, thanks for the quick reply! I can definitely wait as much as needed, no worries about that. Glad to know the 1.4 version still exists! 😄
Sorry I took so long!


The link above should do it. However the only platform that is guaranteed to work with GMS 1.4 is Windows. If you need macOS and/or Ubuntu support please let me know and I'll get it working on those as well. For Ubuntu support it will take longer however because I'll need to install Ubuntu 18.04 Bionic Beaver 32-bit in a Virtual Machine as that is the newest and last version of Ubuntu supported by GMS 1.4.
 

UsagiDood

Member
Sorry I took so long!

The link above should do it. However the only platform that is guaranteed to work with GMS 1.4 is Windows. If you need macOS and/or Ubuntu support please let me know and I'll get it working on those as well. For Ubuntu support it will take longer however because I'll need to install Ubuntu 18.04 Bionic Beaver 32-bit in a Virtual Machine as that is the newest and last version of Ubuntu supported by GMS 1.4.
Thank you very much! Again, there was absolutely no problem in waiting despite the fact it was pretty fast. However I have one problem, I just tested out the project file you linked, and while the audio plays and example text draws on screen, the rest of the window is black as no video is showing... I haven't touch the project at all but maybe there is something I have to do beforehand?
As for the support for other platforms, while it would come in extremely handy, I truly do not want to ask too much from you, but thanks again.
 
S

Sam (Deleted User)

Guest
Thank you very much! Again, there was absolutely no problem in waiting despite the fact it was pretty fast. However I have one problem, I just tested out the project file you linked, and while the audio plays and example text draws on screen, the rest of the window is black as no video is showing... I haven't touch the project at all but maybe there is something I have to do beforehand?
As for the support for other platforms, while it would come in extremely handy, I truly do not want to ask too much from you, but thanks again.
I don't know why the video wouldn't be showing, but i do know i accidentally sent you a project that rendered the videos in such a way reds were swapped with blues on the color wheel. This was because GMS2 handles colors differently than GMS1 when it comes to buffers. That is now fixed, sorry for the wait, and let me know if this solves the issue you were having on your end as well:


Please let me know if you need macOS High Sierra i386/amd64 Universal and/or Ubuntu 18.04 LTS i386 support, as those are what GMS 1.4.x supports natively. It might support newer macs, but I'm just going by what I remember the 1.4 system requirements page said iirc.
 

IGameArt

Member
For some reason i'm having a hard time getting this to work. I've created a custom video player object and it's failing after loading the example video you've provided because both video_get_width and video_get_height return zero.
 
S

Sam (Deleted User)

Guest
For some reason i'm having a hard time getting this to work. I've created a custom video player object and it's failing after loading the example video you've provided because both video_get_width and video_get_height return zero.
I'll need to see your code. Additionally, you can only use the 32-bit dll that comes with it using the 32-bit runtime. For the 64-bit runtime you need the 64-bit dll on github (link in my webm player description on the marketplace).
 

UsagiDood

Member
I don't know why the video wouldn't be showing, but i do know i accidentally sent you a project that rendered the videos in such a way reds were swapped with blues on the color wheel. This was because GMS2 handles colors differently than GMS1 when it comes to buffers. That is now fixed, sorry for the wait, and let me know if this solves the issue you were having on your end as well:


Please let me know if you need macOS High Sierra i386/amd64 Universal and/or Ubuntu 18.04 LTS i386 support, as those are what GMS 1.4.x supports natively. It might support newer macs, but I'm just going by what I remember the 1.4 system requirements page said iirc.
Sorry I took to so long to reply back, I wasn't home for the past days!

For some reason, the video footage still refuses to draw. I tried to test each value initiated and all of them return what should be returned. Now the only thing that I think could break the dll is that I am on a 64-bit machine?
For the additional platform support, the only extra one I would need is Linux support since I have no way to test/export Mac applications.
 
S

Sam (Deleted User)

Guest
Sorry I took to so long to reply back, I wasn't home for the past days!

For some reason, the video footage still refuses to draw. I tried to test each value initiated and all of them return what should be returned. Now the only thing that I think could break the dll is that I am on a 64-bit machine?
For the additional platform support, the only extra one I would need is Linux support since I have no way to test/export Mac applications.
It should work regardless of whether you are on 32-bit or 64-bit windows. It's the exe and dll which need to be 32-bit in your case, which both are. Perhaps try adding me on discord and we could debug this further. Samuel Venable#5465
 
S

Sam (Deleted User)

Guest
I've decided to drop support for 1.4 for my assets. It's become too much to maintain. I'm sorry.
 

Director_X

Member
Great stuff. Are you planning for this to work for mobile platforms?

Also, can this be used to "skin" an object? I remember in the golden GM4.x days someone made a video player using an object, and we could use it as any object (eg. bounce about the screen and even collide with it, etc) as that opens up new possibilities! :)
 
S

Sam (Deleted User)

Guest
Great stuff. Are you planning for this to work for mobile platforms?

Also, can this be used to "skin" an object? I remember in the golden GM4.x days someone made a video player using an object, and we could use it as any object (eg. bounce about the screen and even collide with it, etc) as that opens up new possibilities! :)
Considering GameMaker is limited to Java-only extensions and can't do native C++ ones for Android, that's a no-go. As for iOS I don't own an iOS device or have an Apple Developer Program membership so I'm not in a position to do either right now. But it's at least possible on iOS for anyone who'd like to do it for me. This topic is misleading, as this is about an old video player I wrote I had to take down due to patent issues. If you want to use my WebM Video Player, that's much better and is still available on the Marketplace and itch, and it can render to a surface.
 
S

Sam (Deleted User)

Guest
It seems not working properly when the video is located under working directory(progress end without error message), somehow using get_open_filename and pick the same file works properly.
Hopefully you can help me out!
x64, 2.3.1
Perhaps you could add me on discord so we can debug this?

Samuel Venable#5465
 
Status
Not open for further replies.
Top