Attract-Mode Support Forum

Attract-Mode Support => Scripting => Topic started by: qqplayer on January 24, 2017, 09:19:57 AM

Title: Add loading video
Post by: qqplayer on January 24, 2017, 09:19:57 AM
I´m trying to add a loading.mp4 video for some systems using the property "when = Transition.ToGame," but the video seems to play behind AM when start the layout.
Any help with this stuff?
Could be awesome add a FadIn sequence like on hyperspin maybe with an external module or some dedicated function.

Title: Re: Adding loading video
Post by: keilmillerjr on January 24, 2017, 12:30:35 PM
Make sure your layer is top most and just toggle visibility or opacity for fade.
Title: Re: Adding loading video
Post by: qqplayer on January 24, 2017, 12:38:49 PM
Make sure your layer is top most and just toggle visibility or opacity for fade.

Yes , but the thing is , AM starts playing the mp4 file when starts the layout , not when I launch the game.
It plays on the background even with opacity 0.
So when it fades in , can be playing on second 1 or second 20 its totally random.

I need a function or wathever to start the video only when I launch the game not before.
Title: Re: Adding loading video
Post by: keilmillerjr on January 24, 2017, 12:50:46 PM
Make sure your layer is top most and just toggle visibility or opacity for fade.

Yes , but the thing is , AM starts playing the mp4 file when starts the layout , not when I launch the game.
It plays on the background even with opacity 0.
So when it fades in , can be playing on second 1 or second 20 its totally random.

I need a function or wathever to start the video only when I launch the game not before.

You need to stop and the video from playing and then have it start playing when during your transition. See layout.md. If you still have trouble, put your code in the post and I'll look at it when I get out from work.
Title: Re: Adding loading video
Post by: qqplayer on January 24, 2017, 01:08:24 PM
Make sure your layer is top most and just toggle visibility or opacity for fade.

Yes , but the thing is , AM starts playing the mp4 file when starts the layout , not when I launch the game.
It plays on the background even with opacity 0.
So when it fades in , can be playing on second 1 or second 20 its totally random.

I need a function or wathever to start the video only when I launch the game not before.

You need to stop and the video from playing and then have it start playing when during your transition. See layout.md. If you still have trouble, put your code in the post and I'll look at it when I get out from work.

I made this:

Code: [Select]
{
local basebar = fe.add_image( "loading/basebar.mp4", 0, 0, flw, flh );
basebar.alpha=0;

local alphabase_cfg = {
    when = Transition.ToGame,
    property = "alpha",
    start = 0,
    end = 255,
    time = 100
    delay = 1000
}
animation.add( PropertyAnimation( basebar, alphabase_cfg ) );

local hidebase_cfg = {
    when = Transition.FromGame,
    property = "alpha",
    start = 255,
    end = 0,
    time = 100
    wait = true
}
animation.add( PropertyAnimation( basebar, hidebase_cfg ) );

}

Maybe using video_flags (Vid.NoAutoStart) but I want to autoplay my videosnaps.
Title: Re: Adding loading video
Post by: keilmillerjr on January 24, 2017, 02:33:29 PM
I have no idea how to use the animation module.

You need to add the following:
basebar.video_flags = Vid.NoAutoStart;
baseball.video_flags = Vid.NoLoop;

You could create a separate transition callback to enable video_playing, and then another to disable it again. But all this can be achieved without using the animation module and only using transition and tick callbacks.
Title: Re: Adding loading video
Post by: qqplayer on January 24, 2017, 02:53:30 PM
I have no idea how to use the animation module.

You need to add the following:
basebar.video_flags = Vid.NoAutoStart;
baseball.video_flags = Vid.NoLoop;

You could create a separate transition callback to enable video_playing, and then another to disable it again. But all this can be achieved without using the animation module and only using transition and tick callbacks.
Pleas , I need more help , pasted this and still autoplaying:

Code: [Select]
local basebar = fe.add_image( "loading/basebar.mp4", 0, 0, flw, flh );
basebar.alpha=0;
basebar.video_flags = Vid.NoAutoStart;
basebar.video_flags = Vid.NoLoop;
Title: Re: Adding loading video
Post by: keilmillerjr on January 24, 2017, 03:50:57 PM
I think I made a mistake. Try
basebar.video_flags = Vid.NoAutoStart | Vid.NoLoop;
Title: Re: Adding loading video
Post by: qqplayer on January 24, 2017, 06:00:26 PM
Yeah, I tried this too ,but now video doestn start when I launch a game.
Seems to need another extra function to start playing.Any ideas?
Title: Re: Adding loading video
Post by: jedione on January 24, 2017, 06:35:14 PM
is this what you want

http://forum.attractmode.org/index.php?topic=1081.0

would show a demo but "bandicam" records is all F-up....dont't know why
but it works well
Title: Re: Adding loading video
Post by: qqplayer on January 25, 2017, 01:29:41 PM
is this what you want

http://forum.attractmode.org/index.php?topic=1081.0

would show a demo but "bandicam" records is all F-up....dont't know why
but it works well

Couldnt try this today , but I think thath is not what Im trying to do.
In this case uses png and I want to add a mp4 video loading animation.
My problem is stopp autoplaying the video on the background.
What I need is a function to start playing and fade in a video only when I launch a game and also fades out the video before I return to AM.
Title: Re: Adding loading video
Post by: jedione on January 25, 2017, 06:39:03 PM
it works with .mp4 just tested
just need to modify the time....
let me know..tanx
Title: Re: Adding loading video
Post by: qqplayer on January 26, 2017, 06:52:27 AM
it works with .mp4 just tested
just need to modify the time....
let me know..tanx

Well is working , but has the same problem , try to test with a 20 second video for example.
And open and close various games ‎one after another.
It shows the video but randomly , not from the begining (second 0).
Sometimes second 3 , sometimes second 14 ...

Still needing help with this stuff.
Title: Re: Adding loading video
Post by: keilmillerjr on January 26, 2017, 09:07:05 AM
I could make a plugin to do this if. However, it would be useless unless attractmode actually launches the rom in the background and waits until the transition to game is completed. Does it do this?
Title: Re: Adding loading video
Post by: qqplayer on January 26, 2017, 12:37:45 PM
I could make a plugin to do this if. However, it would be useless unless attractmode actually launches the rom in the background and waits until the transition to game is completed. Does it do this?

I think that is exactly how it works because I did something similar with a png sequence and seems to be waiting in the background.
Could be awesome a plugin to add transitions to game and from game.
Title: Re: Adding loading video
Post by: keilmillerjr on January 26, 2017, 01:52:51 PM
I could make a plugin to do this if. However, it would be useless unless attractmode actually launches the rom in the background and waits until the transition to game is completed. Does it do this?

I think that is exactly how it works because I did something similar with a png sequence and seems to be waiting in the background.
Could be awesome a plugin to add transitions to game and from game.

Cool. I'll work on it and hopefully have something preliminary released by the end of the weekend. I already made a class for an intro video that I can modify for this.
Title: Re: Adding loading video
Post by: jedione on January 26, 2017, 02:29:31 PM
Please make a plugin,    that would be great.
Title: Re: Add loading video
Post by: keilmillerjr on February 19, 2017, 10:49:08 PM
This is the code I have so far. Redrawing will make the video appear to never play. Regardless, AttractMode does not launch rom in the background. I am thinking that a true loading screen is impossible at the moment.

Code: [Select]
// Layout User Options
class UserConfig </ help="A plugin that helps create await screens." /> {
</ label="Video Path",
help="The path of the video you want to display.",
order=1 />
videoPath="loading.mp4";
</ label="Run Time",
help="The run time of the video you want to display.",
order=2 />
runTime="5000";
}

// Load Debug Module
local log = null;
if (fe.load_module("Debug")) log = Log();

// Await
class Await {
config = null;
videoPath = "";
runTime = 0;
video = null;

constructor() {
config = fe.get_config();
videoPath = config["videoPath"];
runTime = config["runTime"].tointeger();

video = fe.add_image(videoPath, 0, 0, fe.layout.width, fe.layout.height);
video.video_flags = Vid.NoAutoStart;
video.video_playing = false;
video.visible = false;
video.zorder = 9999;

fe.add_transition_callback(this, "transitions");
}

function transitions(ttype, var, ttime) {
switch(ttype) {
case Transition.ToGame:
if (ttime < runTime) {
video.visible = true;
video.video_playing = true;
return true;
}
break;
case Transition.FromGame:
video.visible = false;
break;
}
return false;
}
}
fe.plugin["Await"] <- Await();

Title: Re: Add loading video
Post by: qqplayer on March 10, 2017, 08:32:55 AM
Thanks for the effort.
We can use rocketlauncher to this but I would like to have an oprtion using only AM.
Maybe on future versions, who knows.