播放視頻,找了半天,後來發現沒有代碼。先空着吧。
import Phaser from 'phaser'
class GameScene extends Phaser.Scene {
constructor() {
super({ key: 'GameScene' })
}
preload() {
this.load.video('videodemo', 'assets/example/video/cnn.mp4', 'loadeddata', false, true)
}
create() {
const video = this.add.video(400, 300, 'videodemo')
video.setMute(false)
video.play()
}
}
export function PlayVideoInit(ele) {
return new Phaser.Game({
type: Phaser.AUTO,
width: 800,
height: 600,
backgroundColor: '#2d2d2d',
parent: ele,
scene: [GameScene]
})
}