Jon Guiriba
Jon Guiriba

Reputation: 61

Phaser 2.10 CE video works on web but not on android

Hi guys I am new to Phaser CE 2.10
I am trying to place a video as a bg, it works on web local server as well as my heroku site. However there is an error when I run it on android (7.1.1).

I compile with Cocoonjs

My code is:

var main = function(game){};

main.prototype = {
preload: function(){
  game.load.video("earth_1", "assets/video/earth_1.mp4");
},
create: function(){
var bg = spawner.spawn(g.sprites.bg)
var video = game.add.video("earth_1");
video.unlock();
video.addToWorld();

if(video){
  if(video.width != 0 && video.height !=0){
    video.play(true);
  }else{
    var earth_backup = spawner.spawn(g.sprites.earth_backup)
    earth_backup.scale.set(0.97, 0.97)
  }

}else{
    var earth_backup = spawner.spawn(g.sprites.earth_backup)
    earth_backup.scale.set(0.97, 0.97)
}

I tried changing resolutions too but to no avail. Any sort of help would be greatly appreciated.

I would be really greatful for your help guys

error shown when I try it using cocoon developer app

screenshot

Phaser.Frame: Frame "undefined" has a width or height of zero Phaser.Frame: Frame "undefined" has a width or height of zero Phaser.Loader - video[earth_1] error loading asset from URL false (No supported video URL specified or device does not have video playback support)

Upvotes: 0

Views: 191

Answers (1)

Rathore
Rathore

Reputation: 305

Try using .webm video format instead of .mp4 and it should work. Also please share which device and browser are you using

Upvotes: 0

Related Questions