ithlony / google-cast-sdk

Automatically exported from code.google.com/p/google-cast-sdk
0 stars 0 forks source link

Error Game Manager Listener #624

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Implement a GameManager Listener
2. Add it to the gameManager.

What is the expected output? What do you see instead?
Uncaught Error: Missing listener method for player_available 
event.cast.receiver.games.j.hk @ cast_games_receiver.js:249

Please provide any additional information below.

if you rename the functions, onPlayerAvailable as gd,  onPlayerReady as nd, 
onPlayerIdle as kd and so on... then it works

Original issue reported on code.google.com by boguscla...@gmail.com on 4 Aug 2015 at 4:27

GoogleCodeExporter commented 9 years ago
Could you please share how you implement callback for player_available event?

Original comment by na...@google.com on 6 Aug 2015 at 8:32

GoogleCodeExporter commented 9 years ago
function GameManagerListener(){};

GameManagerListener.prototype.onGameDataChanged = function(_event) {
    console.info("[gameManagerListener][onGameDataChanged]");
    console.info(_event);
};

GameManagerListener.prototype.onGameLoading = function(_event) {
    console.info("[gameManagerListener][onGameLoading]");
    console.info(_event);
};

GameManagerListener.prototype.onGameMessageReceived = function(_event) {
    console.info("[gameManagerListener][onGameMessageReceived]");
    console.info(_event);
};

GameManagerListener.prototype.onGamePaused = function(_event) {
    console.info("[gameManagerListener][onGamePaused]");
    console.info(_event);
};

GameManagerListener.prototype.onGameRunning = function(_event) {
    console.info("[gameManagerListener][onGameRunning]");
    console.info(_event);
};

GameManagerListener.prototype.onGameShowingInfoScreen = function(_event) {
    console.info("[gameManagerListener][onGameShowingInfoScreen]");
    console.info(_event);
};

GameManagerListener.prototype.onGameStatusTextChanged = function(_event) {
    console.info("[gameManagerListener][onGameStatusTextChanged]");
    console.info(_event);
};

GameManagerListener.prototype.onLobbyClosed = function(_event) {
    console.info("[gameManagerListener][onLobbyClosed]");
    console.info(_event);
};

GameManagerListener.prototype.onLobbyOpen = function(_event) {
    console.info("[gameManagerListener][onLobbyOpen]");
    console.info(_event);
};

GameManagerListener.prototype.onPlayerAvailable = function(_event) {
    console.info("[gameManagerListener][onPlayerAvailable]");
    console.info(_event);
};

GameManagerListener.prototype.onPlayerDataChanged = function(_event) {
    console.info("[gameManagerListener][onPlayerDataChanged]");
    console.info(_event);
};

GameManagerListener.prototype.onPlayerDropped = function(_event) {
    console.info("[gameManagerListener][onPlayerDropped]");
    console.info(_event);
};

GameManagerListener.prototype.onPlayerIdle = function(_event) {
    console.info("[gameManagerListener][onPlayerIdle]");
    console.info(_event);
};

GameManagerListener.prototype.onPlayerPlaying = function(_event) {
    console.info("[gameManagerListener][onPlayerPlaying]");
    console.info(_event);
};

GameManagerListener.prototype.onPlayerQuit = function(_event) {
    console.info("[gameManagerListener][onPlayerQuit]");
    console.info(_event);
};

GameManagerListener.prototype.onPlayerReady = function(_event) {
    console.info("[gameManagerListener][onPlayerReady]");
    console.info(_event);
};

this.gameManagerListener = new GameManagerListener();

/* */

this.gameManager_.addGameManagerListener(this.gameManagerListener);

// This is the code that fails. But if I write the nexts lines before adding 
GameManagerListener, then it works. Thanks

this.gameManagerListener.gd = this.gameManagerListener.onPlayerAvailable;
this.gameManagerListener.nd = this.gameManagerListener.onPlayerReady;
this.gameManagerListener.kd = this.gameManagerListener.onPlayerIdle;
this.gameManagerListener.ld = this.gameManagerListener.onPlayerPlaying;
this.gameManagerListener.jd = this.gameManagerListener.onPlayerDropped;
this.gameManagerListener.md = this.gameManagerListener.onPlayerQuit;
this.gameManagerListener.$c = this.gameManagerListener.onGameMessageReceived;
this.gameManagerListener.Zc = this.gameManagerListener.onGameLoading;
this.gameManagerListener.bd = this.gameManagerListener.onGameRunning;
this.gameManagerListener.ad = this.gameManagerListener.onGamePaused;
this.gameManagerListener.cd = this.gameManagerListener.onGameShowingInfoScreen;
this.gameManagerListener.fd = this.gameManagerListener.onLobbyOpen;
this.gameManagerListener.ed = this.gameManagerListener.onLobbyClosed;
this.gameManagerListener.hd = this.gameManagerListener.onPlayerDataChanged;
this.gameManagerListener.Yc = this.gameManagerListener.onGameDataChanged;
this.gameManagerListener.dd = this.gameManagerListener.onGameStatusTextChanged;

Greetings.

Original comment by boguscla...@gmail.com on 7 Aug 2015 at 4:57

GoogleCodeExporter commented 9 years ago
Please note that, in order to determine any player state changes the app should 
implement GameManagerClient.Listener and then in the onStateChanged callback 
use the GameManagerState.getPlayersInState. Read more here: 
https://developers.google.com/android/reference/com/google/android/gms/cast/game
s/GameManagerClient

Original comment by na...@google.com on 11 Aug 2015 at 12:16

GoogleCodeExporter commented 9 years ago
I know , but that is not the question.
The problem is that I implement GameManagerListener 
https://developers.google.com/cast/docs/reference/receiver/cast.receiver.games.G
ameManagerListener and I add it to the GameManager with:

this.gameManagerListener = new GameManagerListener();
this.gameManager_.addGameManagerListener(this.gameManagerListener);

I get the following Error:

Uncaught Error: Missing listener method for player_available 
event.cast.receiver.games.j.hk @ cast_games_receiver.js:249

I think it is a bug on receiver's sdk, and dont understand why you answered 
that... It has nothing to do with it

Original comment by boguscla...@gmail.com on 11 Aug 2015 at 2:54

GoogleCodeExporter commented 9 years ago
Thank you for reporting the issue. Our team is working on it. We'll update the 
tracker accordingly.

Original comment by na...@google.com on 12 Aug 2015 at 12:10