mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2025-02-17 02:22:36 +01:00
changes
This commit is contained in:
parent
7ba1ecdcc1
commit
3086a8446f
@ -444,7 +444,7 @@ export class MusicController implements IMusicController
|
||||
{
|
||||
this.notifySongPlaying(songData);
|
||||
}
|
||||
this._musicPlayer.play(songData.songData, startPos, playLength);
|
||||
this._musicPlayer.play(songData.songData, songData.id, startPos, playLength);
|
||||
if(priority > MusicPriorities.PRIORITY_ROOM_PLAYLIST)
|
||||
{
|
||||
Nitro.instance.soundManager.events.dispatchEvent(new NowPlayingEvent(NowPlayingEvent.NPE_USER_PLAY_SONG, priority, songData.id, -1));
|
||||
|
@ -6,6 +6,7 @@ import { TraxData } from '../trax/TraxData';
|
||||
export class MusicPlayer
|
||||
{
|
||||
private _currentSong: TraxData | undefined;
|
||||
private _currentSongId: number;
|
||||
private _startPos: number;
|
||||
private _playLength: number;
|
||||
private _isPlaying: boolean;
|
||||
@ -27,7 +28,7 @@ export class MusicPlayer
|
||||
this._cache = new Map<number, Howl>();
|
||||
}
|
||||
|
||||
public async play(song: string, startPos: number = 0, playLength: number = -1): Promise<void>
|
||||
public async play(song: string, currentSongId: number, startPos: number = 0, playLength: number = -1): Promise<void>
|
||||
{
|
||||
this.reset();
|
||||
|
||||
@ -35,6 +36,7 @@ export class MusicPlayer
|
||||
this._startPos = Math.trunc(startPos);
|
||||
this._playLength = playLength;
|
||||
this._currentPos = this._startPos;
|
||||
this._currentSongId = currentSongId;
|
||||
//this.emit('loading');
|
||||
await this.preload();
|
||||
this._isPlaying = true;
|
||||
@ -174,7 +176,7 @@ export class MusicPlayer
|
||||
{
|
||||
if(this._currentPos > this._playLength - 1)
|
||||
{
|
||||
Nitro.instance.soundManager.events.dispatchEvent(new SoundManagerEvent(SoundManagerEvent.TRAX_SONG_COMPLETE, Nitro.instance.soundManager.musicController.getRoomItemPlaylist().nowPlayingSongId));
|
||||
Nitro.instance.soundManager.events.dispatchEvent(new SoundManagerEvent(SoundManagerEvent.TRAX_SONG_COMPLETE, this._currentSongId));
|
||||
this.stop();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user