summaryrefslogtreecommitdiff
path: root/src/audio/player.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio/player.c')
-rw-r--r--src/audio/player.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/audio/player.c b/src/audio/player.c
index a2a3955b..94bcd065 100644
--- a/src/audio/player.c
+++ b/src/audio/player.c
@@ -455,6 +455,8 @@ struct Impl_Player {
455 iAVFAudioPlayer * avfPlayer; /* iOS */ 455 iAVFAudioPlayer * avfPlayer; /* iOS */
456}; 456};
457 457
458static iPlayer *activePlayer_;
459
458iDefineTypeConstruction(Player) 460iDefineTypeConstruction(Player)
459 461
460static size_t sampleSize_Player_(const iPlayer *d) { 462static size_t sampleSize_Player_(const iPlayer *d) {
@@ -655,8 +657,14 @@ void deinit_Player(iPlayer *d) {
655#if defined (iPlatformAppleMobile) 657#if defined (iPlatformAppleMobile)
656 if (d->avfPlayer) { 658 if (d->avfPlayer) {
657 delete_AVFAudioPlayer(d->avfPlayer); 659 delete_AVFAudioPlayer(d->avfPlayer);
660 if (activePlayer_ == d) {
661 clearNowPlayingInfo_iOS();
662 }
658 } 663 }
659#endif 664#endif
665 if (activePlayer_ == d) {
666 activePlayer_ = NULL;
667 }
660} 668}
661 669
662iBool isStarted_Player(const iPlayer *d) { 670iBool isStarted_Player(const iPlayer *d) {
@@ -739,6 +747,7 @@ iBool start_Player(iPlayer *d) {
739 if (d->avfPlayer) { 747 if (d->avfPlayer) {
740 play_AVFAudioPlayer(d->avfPlayer); 748 play_AVFAudioPlayer(d->avfPlayer);
741 setNotIdle_Player(d); 749 setNotIdle_Player(d);
750 activePlayer_ = d;
742 return iTrue; 751 return iTrue;
743 } 752 }
744#endif 753#endif
@@ -756,6 +765,7 @@ iBool start_Player(iPlayer *d) {
756 d->decoder->gain = d->volume; 765 d->decoder->gain = d->volume;
757 SDL_PauseAudioDevice(d->device, SDL_FALSE); 766 SDL_PauseAudioDevice(d->device, SDL_FALSE);
758 setNotIdle_Player(d); 767 setNotIdle_Player(d);
768 activePlayer_ = d;
759 return iTrue; 769 return iTrue;
760} 770}
761 771
@@ -889,3 +899,7 @@ iString *metadataLabel_Player(const iPlayer *d) {
889 } 899 }
890 return meta; 900 return meta;
891} 901}
902
903iPlayer *active_Player(void) {
904 return activePlayer_;
905}