omarojo Posted March 28, 2017 Share Posted March 28, 2017 Hi there community, I will be building a video-playlist player. And I was wondering, what is the most efficient way to play the videos without consuming the RAM memory. Imagine we have 30 large videos. Obviously loading them to memory at the beginning of the game will kill the memory. So what do you recommend to play them and not break the experience with looooong 'Loading' screens every time the next video is played, or the user presses the next button or selects from the scroll. This is for a museum, so the idea is that users can switch thru the videos fast and easily, Link to comment Share on other sites More sharing options...
alex_h Posted March 28, 2017 Share Posted March 28, 2017 Can you not stream them? Link to comment Share on other sites More sharing options...
omarojo Posted March 28, 2017 Author Share Posted March 28, 2017 can I ? I thought I had to load the files to memory before using them. What is the sample code to stream a video from disk ? Link to comment Share on other sites More sharing options...
alex_h Posted March 28, 2017 Share Posted March 28, 2017 I don't know, I guess it depends how you're using them. If you're displaying them as phaser sprites then I imagine yes, you would then need to preload them and scan each frame to create textures. But if you are displaying them as plain html5 <video> elements in front of your game then it is certainly possible to stream them, eg like on youtube. https://developer.mozilla.org/en/docs/Web/HTML/Element/video Link to comment Share on other sites More sharing options...
Babsobar Posted March 28, 2017 Share Posted March 28, 2017 Yes, Alex_h has the right answer, even outside phaser, you rarely have the server feed the video directly to the client, it's much easier to use a third party website like youtube or vimeo and tweak the embed settings to make it less "youtuby"( removing the logo, the differents icons that make it immediatly recognizable as youtube). The reason being, the folks over at youtube/vimeo/etc have specialised in their domain and they'll provide you with a much better service than you could hope to code, that, and letting their servers do the heavy lifting on the videos will free up a lot of your server's ressources. The museum might not be so happy that the videos are on youtube or on another "public" website though, you can make them private so that only people with the link or only embedded videos can be seen, but the video will still be made accessible. Link to comment Share on other sites More sharing options...
omarojo Posted March 28, 2017 Author Share Posted March 28, 2017 I see... well youtube/vimeo setup is a no go, because that requires a stable internet connection. For something that is just a videoplayer for kiosk touchtable in a museum. Videos must be stored in disk. The idea is to have a list of videos thumbnails with descriptions and be able to select which video to play, maybe add some extra UI goodies and effects. But maybe Phaser is not the right tool for this. Link to comment Share on other sites More sharing options...
alex_h Posted March 29, 2017 Share Posted March 29, 2017 I'd suggest taking a look at phaser source code to see how it deals with video. Maybe it can handle streaming? If not then yes, you're probably better off going for a DOM based solution. You don't need to use a remote streaming server, streaming from localhost should still be fine. Link to comment Share on other sites More sharing options...
alex_h Posted March 29, 2017 Share Posted March 29, 2017 It says here that you can stream video in Phaser: https://github.com/photonstorm/phaser/blob/master/v2/src/gameobjects/Video.js#L10-L11 Link to comment Share on other sites More sharing options...
Recommended Posts