PhaserEditor2D / PhaserEditor2D-v3

A web-based IDE for HTML5 game development. Powered by Phaser.
https://phasereditor2d.com
MIT License
426 stars 57 forks source link

Feature: Video support #246

Open zombiestruck opened 1 year ago

zombiestruck commented 1 year ago

It would be very handy to be able to add videos to a scene.

ChildLearningClub commented 1 year ago

Plus 1 :)

Edit: with the ability to also loadURL option would be really nice too.

zombiestruck commented 1 year ago

Also it may be nice to have a video queue with an option to loop the queue. I'm using the video on complete event to chain them.

PhaserEditor2D commented 1 year ago

Hi @zombiestruck!

Also it may be nice to have a video queue with an option to loop the queue. I'm using the video on complete event to chain them.

Please can you explain this better? The "video queue" is something supported by Phaser?

ChildLearningClub commented 1 year ago

I think maybe just the “on video complete” signal is fired in Phaser 3 and @zombiestruck has another video play after and does that for a few videos. So in PhaserEditor2D to have on the right hand side after say a video “key” or url box there could be a plus button to add more that would then chain them together. Additionally there could be a “timer” timer wait time in seconds or play next video on action (like button press) before starting the next video asset or url linked video. Correct me if I’m wrong @zombiestruck ?

PhaserEditor2D commented 1 year ago

It looks like something too specific. I think you can add the videos to an ObjectList and later execute them using a utility you did manually. Something like:

manager = new VideoManager(this.videoList)
manager.play()
ChildLearningClub commented 1 year ago

I thought maybe that was the case too.

zombiestruck commented 1 year ago

This was my quick and dirty solution. I was considering creating a system as you posted, but figured this would be good enough for now. I have a series of clips to play so a built-in queue would be nice.

attractVid1.on('complete', function(video){
            attractVid1.alpha = 0;
            attractVid2.alpha = 1;  
            attractVid2.play();
            attractVid1.setPaused(true);
            attractVid2.setPaused(false);
        }, this);

        attractVid2.on('complete', function(video){
            attractVid3.alpha = 1;
            attractVid2.alpha = 0;      
            attractVid3.play();
            attractVid2.setPaused(true);
            attractVid3.setPaused(false);
        }, this);

        attractVid3.on('complete', function(video){
            attractVid1.alpha = 1;
            attractVid3.alpha = 0;      
            attractVid1.play();
            attractVid3.setPaused(true);
            attractVid1.setPaused(false);
        }, this);