Jump to content

Responsive Phaser Games and video files


Recommended Posts

I'm knew to Phaser, I have 2 general questions after looking at the code, documentation and examples.  And trying a few.

I have a single page game

Right now I'm using game.js main.js and preload.js
and phaser.min.js
 with of course an index.html

What are some of the things in Phaser 2.4.4 that make Phaser responsive across platforms?

Something like this?:

<meta name="viewport" content="initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no,width=device-width" />
    <meta name="screen-orientation" content="portrait"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="full-screen" content="yes"/>
    <meta name="x5-fullscreen" content="true"/>

 <!-- Fix viewport on Android-->
    <script type="text/javascript">
    // Listen for orientation changes
    window.addEventListener("orientationchange", function() {
        // Only apply the fix on Android
        var ua = navigator.userAgent.toLowerCase();
        var isAndroid = ua.indexOf("android") > -1;
        if(isAndroid) {
            // Reset the viewport settings with a high-enough width
            var viewport = document.querySelector("meta[name=viewport]");
            viewport.setAttribute('content', 'initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no,width=device-width');
    }, false);

I'm guessing the viewport meta is the main thing, right?

And what is the main problem with porting this over to iOS and Android?
I'm guessing the clicks,taps and touch code on the mobile screens.????


Also, Why does the code for playing videos such as the following, (this is just one example)
seem to work fine on the phaser sites online; but offline, even on a Xamp or LEMP server, they don't play?????  The code seems simple enopugh.  And I'm talking small size videos. Is this a cross-browser problem, I noticed it doesn't work on IE 9
Works on some versions of Firefox???

  game.load.video('liquid', 'assets/video/skull.mp4');
    game.load.video('space', 'assets/video/wormhole.mp4');


var video1;
var video2;

function create() {

    video1 = game.add.video('space');
    video2 = game.add.video('liquid');


    //  x, y, anchor x, anchor y, scale x, scale y
    video1.addToWorld(400, 300, 0.5, 0.5);

    video2.addToWorld(780, 580, 1, 1, 0.5, 0.5);




Link to comment
Share on other sites


  • Recently Browsing   0 members

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