Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PinballY Loading Videos #17

Open
shurley6201 opened this issue Sep 30, 2021 · 8 comments
Open

PinballY Loading Videos #17

shurley6201 opened this issue Sep 30, 2021 · 8 comments

Comments

@shurley6201
Copy link

Is it possible to create a script for PinballY that uses Loading videos for each game like PinballX currently can do?

@mjrgh
Copy link
Contributor

mjrgh commented Sep 30, 2021

Take a look at the help under Javascript scripting > Worked Examples > "Seamless" Game Launch, particularly Playing an animated overlay near the end of the chapter.

@shurley6201
Copy link
Author

shurley6201 commented Oct 2, 2021 via email

@shurley6201
Copy link
Author

shurley6201 commented Oct 16, 2021 via email

@shurley6201
Copy link
Author

shurley6201 commented Oct 25, 2021 via email

@shurley6201
Copy link
Author

Found a loading video script and added that as an import to main.js. I do not receive errors in the PinballY.log but still do not get any videos.. any ideas?

@RichardL64
Copy link

Here you go - runs game specific video if it exists or launch video if not from pinbally/media/videos folder.

https://github.com/RichardL64/Visual-Pinball/blob/main/PinballY/LaunchVideo.js

@csdf27
Copy link

csdf27 commented Jun 16, 2023

I have zero javascript knowledge so forgive me if this is a stupid question, but I wanted to introduce a delay to the video stop event to account for the fact that even once VPX has started, nothing appears on screen for a few more seconds, and i want the loading video to continue to be visible for that time. My attempt was to change the myGameStarted function to the following (for a 3 second delay):
function myGameStarted(ev) {
setTimeout(mainWindow.launchOverlay.bg.clear(0xff000000),3000);
}
But this appears to have zero effect. An alternative was just to comment out the gamestarted event hook entirely, which works fine except I think video continues running in the background somewhere which is a bit wasteful. And when you exit the table, the loading video briefly reappears again.

Any suggestions?

@RichardL64
Copy link

RichardL64 commented Nov 5, 2023

Hi - apologies for not replyng earlier...
re
function myGameStarted(ev) {
setTimeout(mainWindow.launchOverlay.bg.clear(0xff000000),3000);
}
This approach looks good to me;

  1. Did the video work before you made any changes - i.e. we have a good functioning baseline
  2. When you made the change below - did pinbally.log give any sort of errors?

Another thing to try is moving the code into its own function, with some logging so you can see what happens in pinballY.log - and perhaps test with a huge delay to make it obvious its working?

I seem to remember brackets after the function make JS call it immediately - so your code above actually shuts down the window right away when what you want to do is pass the function name to the timer - so the following may work (note stopVideo has no brackets after it in the setTimeout call)

function myGameStarted(ev) {
setTimeout(stopVideo, 10000);
}

function stopVideo() {
logfile.log("[LaunchVideo] stopping video");
mainWindow.launchOverlay.bg.clear(0xff000000);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants