private void audioPlayback(PodcastEpisodeModel episodeModel) { // Save the state for the previously playing podcast episode. if (m_currentEpisode != null) { saveEpisodePlayPosition(m_currentEpisode); m_currentEpisode.EpisodeState = m_originalEpisodeState; } m_originalEpisodeState = episodeModel.EpisodeState; m_currentEpisode = episodeModel; m_appSettings.Remove(App.LSKEY_PODCAST_EPISODE_PLAYING_ID); m_appSettings.Add(App.LSKEY_PODCAST_EPISODE_PLAYING_ID, m_currentEpisode.PodcastId); m_appSettings.Save(); setupPlayerUIContent(m_currentEpisode); showPlayerLayout(); if (m_currentEpisode.SavedPlayPos > 0) { askForContinueEpisodePlaying(); } else { startPlayback(); } m_currentEpisode.SavedPlayPos = 1; // To mark that the playback has started - we update UI correctly in podcast listing. }
private void restoreEpisodeToPlayerUI() { // If we have an episodeId stored in local cache, this means we have that episode playing. // Hence, here we need to reload the episode data from the SQL. if (m_appSettings.Contains(App.LSKEY_PODCAST_EPISODE_PLAYING_ID)) { int episodeId = (int)m_appSettings[App.LSKEY_PODCAST_EPISODE_PLAYING_ID]; m_currentEpisode = PodcastSqlModel.getInstance().episodeForEpisodeId(episodeId); m_originalEpisodeState = m_currentEpisode.EpisodeState; if (m_currentEpisode == null) { // Episode not in SQL anymore (maybe it was deleted). So clear up a bit... m_appSettings.Remove(App.LSKEY_PODCAST_EPISODE_PLAYING_ID); return; } setupPlayerUIContent(m_currentEpisode); setupUIForEpisodePlaying(); } else { showNoPlayerLayout(); Debug.WriteLine("WARNING: Could not find episode ID from app settings, so cannot restore player UI with episode information!"); } }
public void streamEpisode(PodcastEpisodeModel episodeModel) { StopPlayback(); m_originalEpisodeState = episodeModel.EpisodeState; m_currentEpisode = episodeModel; startPlayback(TimeSpan.Zero, true); setupUIForEpisodePlaying(); setupPlayerUIContent(episodeModel); showPlayerLayout(); }