private void StopTrack() { if (StreamingPlayer.StopPlayer()) { icon_playPause_button.Kind = (MaterialDesignThemes.Wpf.PackIconKind)Enum.Parse(typeof(MaterialDesignThemes.Wpf.PackIconKind), "Play"); loadProgressTrackTimer.Stop(); } }
public static async Task <bool> UploadTrackAsync(Track track) { try { RequestTrackAudio requestTrackAudio = new RequestTrackAudio(); requestTrackAudio.Filename = track.StoragePath; TrackAudio trackAudio = await Session.streamingServerConnection.streamingService.GetTrackAudioAsync(requestTrackAudio); byte[] bytes = trackAudio.Song; StreamingPlayer.StopPlayer(); Mp3FileReader mp3Reader = new Mp3FileReader(new MemoryStream(bytes)); waveStream = new WaveChannel32(mp3Reader); waveOutEvent.Init(waveStream); isTrackReady = true; StreamingPlayer.StartPlayer(); return(true); } catch (Exception ex) { Console.WriteLine(ex); return(false); } }
public static async Task <Track> UploadNextTrack() { if (queueTracks.Count > 0) { StreamingPlayer.StopPlayer(); Track track = queueTracks.Dequeue(); StreamingPlayer.AddTrackToHistory(track); isTrackReady = false; if (await StreamingPlayer.UploadTrackAsync(track)) { return(track); } else { return(null); } } else { return(null); } }