• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

LoneWolff's video player

Hi,

I can't get LoneWolff's video player to work. I tried clicking the support link and it gave me an option to email him through the site. I have done so, several times, and he hasn't gotten back to me.
Has anyone gotten it to work that could help me with it?
 

rIKmAN

Member
Hi,

I can't get LoneWolff's video player to work. I tried clicking the support link and it gave me an option to email him through the site. I have done so, several times, and he hasn't gotten back to me.
Has anyone gotten it to work that could help me with it?
You might get some help if we knew what the issue was - what does "I can't get it to work" mean?

It won't load videos?
Loads them but won't play them?
Plays them but with no sound?
Does it give any error messages when compiling?
Does the demo project work?

it could be one of a hundred things unless you describe what the actual problem is.

It worked fine with GMS2 when I tested it a while ago, and from what I remember the functions are pretty straightforward and there isn't a lot of room for it to be used incorrectly - it's just functions to load and play videos and set the playback speed, volume etc.

Summoning @The Sorcerer.
 
You might get some help if we knew what the issue was - what does "I can't get it to work" mean?

It won't load videos?
Loads them but won't play them?
Plays them but with no sound?
Does it give any error messages when compiling?
Does the demo project work?

it could be one of a hundred things unless you describe what the actual problem is.

It worked fine with GMS2 when I tested it a while ago, and from what I remember the functions are pretty straightforward and there isn't a lot of room for it to be used incorrectly - it's just functions to load and play videos and set the playback speed, volume etc.

Summoning @The Sorcerer.
Didn't mean it didn't work. My mistake. I don't know how to use it. Like what function does what and when to use it.
 

rIKmAN

Member
Didn't mean it didn't work. My mistake. I don't know how to use it. Like what function does what and when to use it.
Does it not come with a manual or readme that lists the functions?
If not, they are all listed on the marketplace page.

The example project shows how to set things up and play a video and most of the functions are in use whilst running the demo and it allows you to change most of them with the keys listed on screen.

Check the Draw Event code - they are pretty self explanatory functions such as video_play(), video_pause(), video_draw(), video_set_sound_level(), video_set_current_time() etc.

There is also some commented info in the example object, but if you double click the extension in the Extension section of the Resource Tree, and then double click the DLL in the file list you can see a full list of all the functions provided by the DLL.
 
@rIKmAN I didn't see a manual anywhere or readme of the sort. I did find a list of functions that self-explanatory, but not completely. i.e., there are no listings of parameters and overall incomplete.
 

Joe Ellis

Member
@rIKmAN I didn't see a manual anywhere or readme of the sort. I did find a list of functions that self-explanatory, but not completely. i.e., there are no listings of parameters and overall incomplete.
It probably is incomplete, LoneWolff was generally selfish, egotistic and mildly skilled with things that seem advanced
 

rIKmAN

Member
@rIKmAN I didn't see a manual anywhere or readme of the sort. I did find a list of functions that self-explanatory, but not completely. i.e., there are no listings of parameters and overall incomplete.
I guess you options are to either use the example object as a base to load your own video, wait for @The Sorcerer to reply in here, or report the asset and get a refund. I personally didn't need documentation as the example was enough to see what needed doing.

Have you tried to load your own video into the example?
As I said the functions are pretty self explanatory and you can see the arguments required for the functions from looking at the source in the demo project.

I'm not sure if I can post code with it being somone elses extension, but everything you need is in the example object.
Init the video and load it in the Create Event, then you can ignore all the keyboard_check_pressed() stuff in the Draw Event as they are essentially controls to forward/rewind, volume+ / volume-, pause / play etc.

To play and draw the video all you need in the Draw event is the part where you check if the surface exists (and if not create it), the surface_set_target() part with video_draw() in it, and then to draw the surface with draw_surface_ext().

There really isn't that much to it setup wise, you can literally copy and paste the parts you need into your own object and change the path to the video file you want to play, or to test just change the path to the video file in the example object instead.
 

Joe Ellis

Member
@rIKmAN we haven't got any evidence that @The Sorcerer is @LoneWolff yet, but they do both live in Australia. Personally I have no problems with @The Sorcerer, and if they are indeed the same base person, I believe he has re-invented himself into a much more likable character, with none of the negative aspects that the previous said character displayed
 

rIKmAN

Member
@rIKmAN we haven't got any evidence that @The Sorcerer is @LoneWolff yet, but they do both live in Australia. Personally I have no problems with @The Sorcerer, and if they are indeed the same base person, I believe he has re-invented himself into a much more likable character, with none of the negative aspects that the previous said character displayed
Speak for yourself, and then why did you tag The Sorcerer with your first post in this thread if you have no evidence to suggest they are the same person?

Also nobody has badmouthed him in this thread except you, so I'm not sure why you are preaching to me about his character.
I know he's a good dude regardless of which username he uses on here.

If he wants to help Ted then great, if he doesn't and Lonewolff no longer exists then we'll help Ted get it working unless he decides to refund it. Simple.
 

Joe Ellis

Member
Speak for yourself, and then why did you tag The Sorcerer with your first post in this thread if you have no evidence to suggest they are the same person?

Also nobody has badmouthed him in this thread except you, so I'm not sure why you are preaching to me about his character.
I know he's a good dude regardless of which username he uses on here.

If he wants to help Ted then great, if he doesn't and Lonewolff no longer exists then we'll help Ted get it working unless he decides to refund it. Simple.
Oh dear, obviously I suspect they're the same person, and I'm not preaching to anyone, especially not you, I've seen where that ends up, and could end up if I say anything else, good night, hope you get this problem sorted :)
 

rIKmAN

Member
Oh dear, obviously I suspect they're the same person, and I'm not preaching to anyone, especially not you, I've seen where that ends up, and could end up if I say anything else, good night, hope you get this problem sorted :)
LOL! It's hard to convey how things are said through text and believe it or not I wasn't being nasty above - and feel free to say whatever you want, these are only conversations and the forum would be dead without them.

Anyway we'll get it sorted if Ted wants to give it a go and not refund.
It's not a difficult extension to use and everything he needs is already right there in the example object that comes with the extension so it's up to him.
 

rIKmAN

Member
Yeah I'll give it a try. First off, how do I import a mp4 into GMS2?
Well you don't have to import it, you can just pass a path to the video file if you want.
ie. Bundle the mp4 in the games directory somewhere and load it from there.

If you prefer to add it to the Resource Tree then just add the mp4 video into Included Files just like you would any other file you wanted to add to the project.

You are better off just bundling it and loading it though, especially if it's a large file.
I just used the path to a 4GB video to test it and loaded it straight from my E:\ drive and it worked fine.
 
Ok that takes care of that. Then what? Is there an init function of some sort?

Init the video and load it in the Create Event, then you can ignore all the keyboard_check_pressed() stuff in the Draw Event as they are essentially controls to forward/rewind, volume+ / volume-, pause / play etc.
And:

Check the Draw Event code - they are pretty self explanatory functions such as video_play(), video_pause(), video_draw(), video_set_sound_level(), video_set_current_time() etc.
 

rIKmAN

Member
Then what? Is there an init function of some sort?
Come on Ted, literally one of the first few lines in the example object is "result_init = video_init(window_device())";
The one under that is the function "video_load()" with the path to the video to play.
The last line is "video_play()"

I don't mind helping you get it working, but at least have a look at the example object first before you start asking silly questions.

I explained everything in my previous post for what you need to do - you need those 3 function above in the Create Event, and in the Draw Event you need to create / set a surface as the render target, draw the video to it and then draw the surface.

Look in the Draw Event of the example object, you can literally copy and paste that code into your own object.
 

rIKmAN

Member
Well @rIKmAN if I could find the example code I think things would be a little easier. Is it on the mar ketplace page? Because I don't see it.
Have you downloaded the extension and imported it into your project?

Click the download button from the marketplace and you will get a .yymp to import manually, or import it from the My Library menu inside the GMS2 IDE and choose to import into a new blank project (tickbox on the bottom left of the window).

In that list you should be able to see the assets that will get imported - including an example object and a video file.
Make sure you select to import ALL assets, and then look through the Resource Tree.

This is what I see when I attempt to import the extension:

 

rIKmAN

Member
@Ted Gress There is nothing in the readme except attribution for the video and music in the video, and there wouldn't be usable / runnable code contained in a readme.txt file for you to run anyway.

OPEN THE EXAMPLE OBJECT AND LOOK AT THE CODE! :D :rolleyes:

See the object called `obj_video`?
That is the object that inits, loads, plays and draws the video if you run the example room.

If you'd imported it into a blank project like I'd said you would have been able to see this and run the example project and seen the video playing.

All the code I've been talking about this whole time is in the Create Event and the Draw Event of this object. You need 3 functions from the Create Event, and the surface creation / drawing part from the Draw Event and that's it - the rest is for the onscreen controls for volume and forward/rewind etc.

Oh and edit the path to your own video file that you want to play!
 
Last edited:
@rIKmAN Hahaha...I'm a little hairbrained at times. I loaded a new project, took a lot at the example, and it worked, and tried to swap the example video for the video I'm trying to play. It plays but I can only see one quarter of the video as it plays - the upper left corner.
 

rIKmAN

Member
@rIKmAN Hahaha...I'm a little hairbrained at times. I loaded a new project, took a lot at the example, and it worked, and tried to swap the example video for the video I'm trying to play. It plays but I can only see one quarter of the video as it plays - the upper left corner.
Without looking at the extension code, it sounds like maybe the surface isn't big enough for the video or something similar?

What resolution is the video?
How big is the surface you are creating?
 
Here is what I got. It doesn't play, just throws an error.

So Create

Code:
/// @description Initialisation


// Unlock room speed and disable application surface.
// This is optional and purely for optimisation/benchmark purposes.
room_speed = 9999;
application_surface_enable(false);


// Initialise the video system. Only required to ever call this only once in the application.
result_init = video_init(window_device());


// Load a video from 'Included files'.
result_load = video_load(game.mp4);

// Example of how to load video using anywhere in the windows file system.
// video_load("c:\\b.mp4");


// Create placeholder for the video surface and draw result variable.
video_surface = 0;
result_draw = 0;
and
Draw

Code:
/// @description Example draw usage


// Only create the surface once the video has loaded.
// As we wont nessesarily know its dimensions before this time.
if(!surface_exists(video_surface) && video_get_duration() > 0)
{
    //video_surface = surface_create(video_get_width(), video_get_height());
    video_surface = surface_create(1920, 1080);
    video_draw();    // Pre-draw sets up internal texture mapping after video has confirmed to have started.
}


// Once the surface exists and video is playing, set the surface as the render
// target and draw the video to it. Then we can draw back to the screen.
if(surface_exists(video_surface))
{
    surface_set_target(video_surface)
    result_draw = video_draw();
    surface_reset_target();
    draw_surface_ext(video_surface, 0, 0, 1.0, 1.0, 0, c_white, 1);
}
 

chamaeleon

Member
OH. Forgot that.
So as you can see from the error message, GMS thinks game.mp4 means an object or instance named game with an variable named mp4. Since game is not defined, it aborts. What you want is "game.mp4" at the very least, so you pass a string to the load function instead, like the commented out example call.
 
Guess what. It is already set to that. Ninja to you BaBiA. My display is 1920 x 1080 and my video is 1920 x 1080. I tried just doing full sceen and its still cut off.
 

chamaeleon

Member
Ok wow...yeah so that's taken care of. All I need to do now is figure out how to go to another room after the video is done.
Maybe something in the step event along the lines of
Code:
If video's duration <= video's current time go to some other room
 

chamaeleon

Member
What about something like:

if (video_get_duration >= video_get_current_time?
Why do you have less than equal to?
Primarily because I assume you don't want to switch room in the first step when this code is called. Needless to say, if I had swapped the order of the function calls I would have used a different comparison.
 
if I use this code:
Code:
current_elapsed_time = video_get_current_time - start_time;

if (video_get_duration() >= current_elapsed_time)
{
    room_goto(FirstLevel);
}
It just jumps to the first level.
 

chamaeleon

Member
if I use this code:
Code:
current_elapsed_time = video_get_current_time - start_time;

if (video_get_duration() >= current_elapsed_time)
{
    room_goto(FirstLevel);
}
It just jumps to the first level.
It's getting late, so..
Code:
if (video_get_duration() <= video_get_current_time()) {
    room_goto(FirstLevel);
}
 

chamaeleon

Member
Yeah. Its getting late. I tried that already. Doesn't work
And what does this show if you put it before the if statement?
Code:
show_debug_message("Duration = " + string(video_get_duration()) + ", Current = " + string(video_get_current_time()));
And just to be perfectly clear, when you say it didn't work, you did use parenthesis to actually call the scripts in your code and not simply ending up comparing asset index numbers? Seeing how you haven't always been consistent including them in your code snippets above.
 
Top