triacontane / RPGMakerMV

RPGツクールMV、MZで動作するプラグインです。
Other
283 stars 131 forks source link

Add video fully loaded signal to MoviePicture.js #93

Open wsVIC opened 3 months ago

wsVIC commented 3 months ago

In some instances, it's beneficial to know when a movie has finished loading, which essentially aligns with the emission of the "canplaythrough" event of the

Following a series of tests, I've observed that when the system is strained or lacks sufficient computational power, the movie loading process can become laggy. This can cause the actual playing time to exceed expectations, resulting in desynchronization with other operations that are designed to run parallel to the film. The attached images illustrate this issue.

By providing a "fully loaded" point, we could enhance synchronization. At present, I'm not aware of any existing solution for this issue, and there seems to be no high-level API that directly caters to this need. One potential solution could be to add an optional parameter to the MP_SET_MOVIE command. This parameter would indicate the switch number to which the movie is attached, and it would be set to true when the movie reaches the 'canplaythrough' state.

image

This problem is especially severe when I try to run a game on Joiplay simulator on my mobile phone, which has poor performance. Nonetheless I am not an expert at RPGMaker MV. So if there is any existing solutions, please let me know.

triacontane commented 3 months ago

Hello!

We are not able to investigate or support the complexity of the plugin for RPG Maker MV, as it has been on the market for some time now.

However, we can implement what you suggest. I have added a switch that can be turned on when the video has completed loading.

https://github.com/triacontane/RPGMakerMV/commit/63890f2ca775046c8217c06faef0331470cb05ee

wsVIC commented 3 months ago

Thank you very much. It works as intended. However, I've noticed a minor issue: the code to set the switch to true appears to execute twice for every SET operation.

further, I discovered that this is due to the "canplaythrough" event of the video element emitting twice, which is quite wierd. (While the addEventListener function is is called only once so there is only one listener.)

Although this is not an immediately urgent issue, it doesn't seem to be the expected behavior. So this would need some further investigations.