Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_initializeMusicControl(): void {
MusicControl.enableBackgroundMode(true);
MusicControl.enableControl('play', true);
MusicControl.enableControl('pause', true);
MusicControl.enableControl('nextTrack', true);
MusicControl.enableControl('previousTrack', true);
MusicControl.on('play', this.togglePlayPause);
MusicControl.on('pause', this.togglePlayPause);
MusicControl.on('nextTrack', this.playNext);
MusicControl.on('previousTrack', this.playPrev);
}
_initializeMusicControl(): void {
MusicControl.enableBackgroundMode(true);
MusicControl.enableControl('play', true);
MusicControl.enableControl('pause', true);
MusicControl.enableControl('nextTrack', true);
MusicControl.enableControl('previousTrack', true);
MusicControl.on('play', this.togglePlayPause);
MusicControl.on('pause', this.togglePlayPause);
MusicControl.on('nextTrack', this.playNext);
MusicControl.on('previousTrack', this.playPrev);
}
_initializeMusicControl(): void {
MusicControl.enableBackgroundMode(true);
MusicControl.enableControl('play', true);
MusicControl.enableControl('pause', true);
MusicControl.enableControl('nextTrack', true);
MusicControl.enableControl('previousTrack', true);
MusicControl.on('play', this.togglePlayPause);
MusicControl.on('pause', this.togglePlayPause);
MusicControl.on('nextTrack', this.playNext);
MusicControl.on('previousTrack', this.playPrev);
}
const { streamChapter } = this.state;
MusicControl.setNowPlaying({
title: `${streamChapter && streamChapter.activeBook.name_id} ${streamChapter && streamChapter.activeChapter}`,
artist: "Alkitab Suara",
duration: this.state.streamDuration,
color: 0xfffffff
});
MusicControl.on("play", () => {
this.setState({ paused: false });
});
MusicControl.on("pause", () => {
this.setState({ paused: true });
});
MusicControl.on("nextTrack", () => {});
MusicControl.on("previousTrack", () => {});
MusicControl.updatePlayback({
state: MusicControl.STATE_PLAYING
});
}
);
async componentDidMount() {
await this.props.getSongs();
MusicControl.enableControl('play', true);
MusicControl.enableControl('pause', true);
MusicControl.enableControl('nextTrack', true);
MusicControl.enableControl('previousTrack', true);
MusicControl.enableControl('seekForward', false);
MusicControl.enableControl('seekBackward', false);
MusicControl.enableBackgroundMode(true);
MusicControl.on('play', ()=> {
this.togglePlay(true);
});
MusicControl.on('pause', ()=> {
this.togglePlay(false);
});
MusicControl.on('nextTrack', this.goForward.bind(this));
MusicControl.on('previousTrack', this.goBackward.bind(this));
}