简体   繁体   English

如何更改预加载的视频 HTML5 Phaser?

[英]How to change preloaded video HTML5 Phaser?

Hi i am using html5 Phaser game engine to make a video flipbook.嗨,我正在使用 html5 Phaser 游戏引擎制作视频翻书。

I load my videos in my preloader like this.我像这样在我的预加载器中加载我的视频。

this.load.video('myVideo1', 'assets/video/video1.mp4');
this.load.video('myVideo2', 'assets/video/video2.mp4');

I add my video to my game like this:我将我的视频添加到我的游戏中,如下所示:

this.video = this.add.video('myVideo1');

I want to use the change source like this;我想像这样使用更改源;

this.video = this.add.video('myVideo' + curScene.toString);

I am using the last part wrong... But i wana use my preloaded video :(我用错了最后一部分......但我想使用我预装的视频:(

Some video information here: http://phaser.io/examples/v2/video/change-source这里的一些视频信息: http : //phaser.io/examples/v2/video/change-source

You shouldn't use this.add.video to change the source;你不应该使用this.add.video来改变源; you should rather use something like this:你应该使用这样的东西:

this.video.changeSource('assets/video/video' + curScene.toString() + '.mp4');

Note that it's not the cache key that is used - it's the full URL to the second video (assuming that curScene.toString() will indeed return "1" or "2").请注意,它不是使用的缓存键 - 它是第二个视频的完整 URL(假设curScene.toString()确实会返回“1”或“2”)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM