How Video objects affect memory consumption and game loading time


I’m building an educational game, where the platformer character jumps around the map and finds the teaching videos. When the player is in certain position and presses the up key, the video starts to play.

I have created “Video” objects to objects list, one object per video (because you must define the video file when creating the object, and the file can’t be changed dynamically). When the certain conditions are met, the Video object is created and played. When the player quits the video, the video object is deleted. This works fine. :slight_smile: Below is the super-simplified example of the code:

Now I’m a bit concerned about the memory consumption and game loading time (this will be played in browser), if I have dozens of Video Player objects defined in the object list (each video about 5-15 MB). When the game is loaded, are the videos preloaded, or are they loaded to memory (or started to stream) only when I create the Video Player object and play the video? Is the memory released when the Video Player object is deleted? I didn’t find any information about this from the documentation.

Thank you in advance!