Jump to content

playing videos on mobile


niceWeather
 Share

Recommended Posts

I did a project where a video is played automatically upon entering the instruction screen. The whole game runs in an iFrame and the code I use is the following:

Sheeple.State.Instructions1.prototype.preload = function() {
	this.load.video('Video1', 'video/video.mp4'); // it's 6 seconds "long"
};

Sheeple.State.Instructions1.prototype.create = function() {
	// add video to game
	this.video = this.game.add.video('Video1');
	this.video.crossorigin = 'anonymous';

	// add video to world to make it viewable
	this.videoAdd = this.video.addToWorld(this.game.width / 2.13, this.tv.position.y - 456, 0.5, 0.5);
	// set anchor and size of video (world)
	this.videoAdd.anchor.set(0.5);
	this.videoAdd.scale.set(1.3);

	// add function to be executed on completion of movie clip 
	this.video.onComplete.add(this.introClip, this);
	// wait half a second until you play the movie clip 
	this.game.time.events.add(500, function() {
		this.video.play();
	}, this);
};

All works well as long as its played on a desktop computer, but for mobile it does not always work.

I understand that some mobile devices require the user to tap the video to start playing and I'm not asking for that. The problem lies therein that on some devices the images are not displayed although the sound is being played. (e.g. Chrome and standard browser for Galaxy S6)

Link to comment
Share on other sites

  • 6 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...