Jump to content

Responsive Phaser Games and video files


TTn6
 Share

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');

    video1.play(true);
    video2.play(true);

    //  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);

}

 


Thanks!

Link to comment
Share on other sites

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...