• To improve security, we will soon start forcing password resets for any account that uses a weak password on the next login. If you have a weak password or a defunct email, please update it now to prevent future disruption.

RPGM RPGM Video Playback Freezing Game - YSP_VideoPlayer.js

jsdeacon

Member
Game Developer
Oct 8, 2019
248
1,101
Hello, looking for a little RPGM MV help here.

I'm using Ver. 1.6.1 and YSP_VideoPlayer.js for video playback. In the last few releases, I have been getting more and more people telling me that the game is freezing when a video is set to play. The game runs fine on both of my PCs, but both have higher-end NVIDIA cards and plenty of ram. The video files are all small MP4 loops (nothing more than 2mb) and I have the events set up like this:

◆Script:ysp.VideoPlayer.loadVideo('Movie')
◆Loop
◆If:Script:ysp.VideoPlayer.isReady()
◆Break Loop

:End

:Repeat Above
◆Script:ysp.VideoPlayer.newVideo('Movie', 1)
: :ysp.VideoPlayer.playVideoById(1)
: :ysp.VideoPlayer.setLoopById(1)
◆Text:None, Transparent, Bottom
: :
◆Script:ysp.VideoPlayer.stopVideoById(1)


From what I can tell, something about them is causing a massive spike in memory/cpu which is freezing the game on lower-end machines. I don't know how to make the files any smaller without severely compromising the quality. Does anyone have any suggestions on how to fix this problem?

Thanksl
- J. S.
 

DoubleLust

Member
Feb 16, 2021
101
297
your game would be alot more stable if you just created those animations as events inside the engine otherwise try transfering the player to a map built for the movie, think a tiny 6x6 map with only the script running, that would eliminate some lag but i have a funny feeling using that plugin on loop every .5-2 sec might be causing issues with potato pc's
 

jsdeacon

Member
Game Developer
Oct 8, 2019
248
1,101
your game would be alot more stable if you just created those animations as events inside the engine otherwise try transfering the player to a map built for the movie, think a tiny 6x6 map with only the script running, that would eliminate some lag but i have a funny feeling using that plugin on loop every .5-2 sec might be causing issues with potato pc's
I am learning it may have to do with updated nw.js and the YSP_VideoPlayer plugin not being compatible with it. I'll update if I learn more.
 

pk2000

Active Member
Aug 12, 2017
707
1,918
I am learning it may have to do with updated nw.js and the YSP_VideoPlayer plugin not being compatible with it. I'll update if I learn more.
Probably the version you used had buggy webgl/webgl2. Every now and then it happens with some nw.js versions.
If it happens in the future, tell your affected customers to change package.json contents from eg.
Code:
{
    "name": "",
    "main": "www/index.html",
    "js-flags": "--expose-gc",
    "window": {
        "title": "",
        "toolbar": false,
        "width": 816,
        "height": 624,
        "position": "center",
        "icon": "www/icon/icon.png"
    }
}
to
Code:
{
    "name": "",
    "main": "www/index.html",
    "js-flags": "--expose-gc",
    "chromium-args": "--disable-webgl",
    "window": {
        "title": "",
        "toolbar": false,
        "width": 816,
        "height": 624,
        "position": "center",
        "icon": "www/icon/icon.png"
    }
}
 

Gnome

Newbie
Jun 11, 2017
44
16
Sadly this isn't just an issue with the YSP_VideoPlayer.js. It's an RM MV (1.6.2) issue in general. I have exactly the same issue when looping video in the eventhandler (no use of plugins). Sometimes they work and sometimes they freeze after just a few frames.
 

defd©™

Engaged Member
Donor
Mar 6, 2019
2,112
2,691
Sadly this isn't just an issue with the YSP_VideoPlayer.js. It's an RM MV (1.6.2) issue in general. I have exactly the same issue when looping video in the eventhandler (no use of plugins). Sometimes they work and sometimes they freeze after just a few frames.
the old RPG MW version 1.5.1 solves this issue
 

defd©™

Engaged Member
Donor
Mar 6, 2019
2,112
2,691
I use the office wife with the version 151 and works fine on mac up to mojave

but in Catalina that version cannot be opened
Mac os catalina.png
 
Last edited:

MLocke

Newbie
Feb 3, 2021
72
68
The busy loop is the culprit. It probably takes over the event loop in the single-threaded JS engine. I can show you how to duplicate the problem and see that the wait is needed. I am not that familiar with RMMV, but they warn you about how to use Wait properly, so there may be a way to use async JS code instead. That's just another consideration.
Code:
◆Loop
  ◆If:Script:ysp.VideoPlayer.isReady()
    ◆Break Loop
    ◆
  :End
  ◆Wait:1 frame
  ◆
:Repeat Above
Don't add the Wait to the Loop yet so that you can verify the behavior.
Add a Text block to the beginning of your event so that you have time to open Dev Tools.
Select All on the blocks in your event and start a Test.
Press F8 to open Dev Tools, go to Network, set Throttling to Slow 3G. This affects things loaded from the file system and not just the web.
Click past the Text on screen.
One of the game subprocesses will lock up. It won't use up 100% CPU or anything, but it's obviously frozen in a way that it won't recover from any time soon.
If you add the Wait, it will load without any hiccups even on the Slow 3G profile.

EDIT: The Slow 3G throttling seems to break a lot of things if you start the game and turn it on for the main menu loading and stuff. So, RMMV in general may have problems with throttling turned on, but I still think the wait has been demonstrated to make your code reliable and is going to help you avoid any problems for people with slow hard drives or whatever.
 
Last edited: