Phaser on iOS (sometimes) stay paused

オープン
#668 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
javascript

調査の方向性

Start by comparing the iOS pause and resume handling with the related issue #663 and the Phaser version discussed in #665; the payload does not name source files or tests. Reproduce the tab-switch behavior on iOS 12.4.6 using the linked video, then trace why resume is not called. Done means the game reliably resumes after returning to its browser tab without the reported manual touch listener.

索引モデルが issue の本文から書いたものです。

説明

bug

This issue may be similar to https://github.com/photonstorm/phaser-ce/issues/663.

Problem is, that when you click icon for browsing tabs (top right corner - see image below) and immediately click on tab with game, then game stays paused=true and looks like frozen. All buttons work, but game stays paused. It looks like resume is not called.
BrowseTabs

It does not happen always. Usually, it happens when you just opend browser and loaded game. I shot video of what happens and it is in .zip below (my iOS version is 12.4.6, I also tried Phaser engine version you attached to case https://github.com/photonstorm/phaser-ce/issues/665, but without success):
paused.zip

As a fix I subscribed to onPause signal in Boot state:

game.onPause.add(this.onPauseHandler, this);

onPauseHandler() looks like this:

    onPauseHandler: function() {
        if (game.device.iOS) {
            this.addMyCanvasListener();
        }
    },

and finally addMyCanvasListener() like this:

    addMyCanvasListener: function() {
        var can = document.getElementById('game-container');
        can.addEventListener('touchstart', function _listener() {
            game.paused = false;
            can.removeEventListener('touchstart', _listener, false);
        }, false);
    },

With this setup I can unpause game if it is still paused after selecting tab.

主要言語
JavaScript
スター
1.4k
フォーク
485
平均マージ
1日 2時間
マージ済み PR(30日)
9

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

phaserjs/phaser-ce のほかの issue

phaserjs/phaser-ce の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。