trying to play a intro video in android chrome browser with ccui.videoplayer. in chrome desktop, it plays directly. in IOS browser, it displays a play icon and plays when pressed. in chrome browser, nothing happens. I tried attaching a listener and delaying the initialization of video to the touch callback, but it seems like it never is fired.
what is the proper way to play video in crhome andriod?
…
if(cc.sys.OS_ANDROID !== cc.sys.os){
this.play_video(); //works in desktop or ios, with play icon
}else{
this._touchListener = cc.EventListener.create({
event: cc.EventListener.TOUCH_ONE_BY_ONE,
swallowTouches: true,
onTouchBegan: function(){},
onTouchMoved: function(){},
onTouchEnded: function(){
console.log(“touch!!!”); //never fired!
_self.play_video();
}
});
cc.eventManager.addListener(this._touchListener, this);
},
play_video: function(){
this.video = new ccui.VideoPlayer();
this.video.setContentSize(960, 640);
this.video.setPosition(960/2,640/2);
window.video = this.video;
this.addChild(this.video);
this.video.setURL(“res/intro.mp4”);
this.video.play();
}