/** 播放教程视频 */

const { ccclass, property } = cc._decorator;

@ccclass
export default class VideoNode extends cc.Component {
    @property(cc.VideoPlayer)
    videoPlayer: cc.VideoPlayer = null;

    onLoad() {

    }

    start() {
        this.videoPlayer.resourceType = cc.VideoPlayer.ResourceType.LOCAL

        let url = ''
        if (gData.redCodeData.teachVideoType == 1) {
            url = 'video/AriesGameClub'
        }
        else {
            url = 'video/Redeem'
        }

        this.playVideo(url)
    }

    playVideo(url) {
        cc.loader.loadRes(url, cc.Asset, (err, res) => {
            this.videoPlayer.clip = res as any
            this.scheduleOnce(() => {
                this.videoPlayer.play()

                mk.audio.setPauseMusic()
                // mk.audio.setTempEffect(false)
            }, 1)
        })
    }
}
