Skip to content
This repository has been archived by the owner on Oct 6, 2022. It is now read-only.

Problems with updatePlayback #412

Open
antonkoetzler opened this issue Sep 26, 2022 · 0 comments
Open

Problems with updatePlayback #412

antonkoetzler opened this issue Sep 26, 2022 · 0 comments

Comments

@antonkoetzler
Copy link

  1. Sample code (provide repo url or sample code)
// Code used to init MusicControl
export async function initNotification(path) {
  MusicControl.stopControl();

  MusicControl.enableBackgroundMode(true);
  MusicControl.enableControl("play", true);
  MusicControl.enableControl("pause", true);
  MusicControl.enableControl("stop", true);
  MusicControl.enableControl("nextTrack", true);
  MusicControl.enableControl("previousTrack", true);
  MusicControl.enableControl("changePlaybackPosition", false);
  MusicControl.enableControl("seekForward", false);
  MusicControl.enableControl("seekBackward", false);
  MusicControl.enableControl("seek", false);
  MusicControl.enableControl("skipForward", false);
  MusicControl.enableControl("skipBackward", false);
  MusicControl.enableControl("setRating", false);
  MusicControl.enableControl("volume", false);
  MusicControl.enableControl("remoteVolume", false);
  MusicControl.enableControl("enableLanguageOption", false);
  MusicControl.enableControl("disableLanguageOption", false);

  let name = null;
  for (var i = (path.length - 1); i >= 0; i--) {
    if (path[i] == '/') {
      name = path.substr(i + 1);
      name = name.substr(0, name.length - 4);
    }
  }

  MusicControl.setNowPlaying({
    title: name,
    artwork: require("./DefaultAlbumCover.png"),
    artist: "",
    album: "",
    genre: "",
    description: "",
    color: 0x7393b3,
    colorized: true,
    date: "",
    isLiveStream: false
  });

  MusicControl.on(Command.previousTrack, previousSong);
  MusicControl.on(Command.play, () => { toggleNotificationPlay(); });
  MusicControl.on(Command.pause, () => { toggleNotificationPlay(); });
  MusicControl.on(Command.nextTrack, nextSong);
}

Whenever I call MusicControl.updatePlayback, it never actually changes anything in the notification. As well, using the notification buttons when the app is in the background never changes the text of the notification.

  1. Platform ? ~ Android
  1. Device ~ Simulator
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant