Skip to content

Profile (Cocos)

FRVRSDK.instance exposes the current player’s channel‑assigned identity — a stable id plus (where the channel still provides it) a display name and photo.

const id    = await FRVRSDK.instance.getPlayerId();
const name  = await FRVRSDK.instance.getPlayerName();
const photo = await FRVRSDK.instance.getPlayerImage();

All are async. id is effectively always available. name and photo are not guaranteed — see below.

For rendering in your UI without dealing with CORS:

if (photo) {
  const dataUrl = await FRVRSDK.instance.loadPlayerImage(photo);
  // dataUrl is "data:image/…;base64,…" — pass it to a SpriteFrame via an Image element, etc.
}

Facebook Instant: name & photo are no longer available

Section titled “Facebook Instant: name & photo are no longer available”
const name   = await FRVRSDK.instance.getPlayerName();
const photo  = await FRVRSDK.instance.getPlayerImage();

this.nameLabel.string = name ?? 'Player';
if (photo) loadAvatar(photo);
else       useDefaultAvatar();

getPlayerId() returns a stable, channel‑assigned id. Use it to key per‑player data that doesn’t need cross‑device sync (local storage keys, analytics user properties, etc.). For cross‑device identity, use the FRVR id attached to the cloud storage layer.