0

I need to vitamio expert's help. I've encountered some issues when I use vitamio library for ios. https://github.com/yixia/Vitamio-iOS/tree/master/Demo

I want to keep the playing song's playback when the app navigate different view controllers. For example, when a user entered first view controllers, some songs are playing. Then if he clicks some buttons, the app goes to another view controllers. At this time, the current playing song on first page should be playing on another view controllers. So I tried to change playback delegate of VMediaPlayer.

//on first view controllers.
[mMPlayer unSetupPlayer];
//on next view controllers.
[mMPlayer setupPlayerWithCarrierView:self.view withDelegate:self];

By the way, when the song is stopped, the playback delegate functions on first view controllers are called. I need it calls the playback delegate on next view controllers.

This issue is related to remove and reset playback delegate for view controllers without the playing song is stopped.

Wain
  • 118,658
  • 15
  • 128
  • 151
gaozhuo
  • 1
  • 1

1 Answers1

0

It doesn't really sound like a vitamio issue, it sounds like an architectural issue. Basically, your view controllers shouldn't own the playback, you should have some other class (possibly a singleton instance of it) as the playback delegate.

Now, the playback delegate could post notifications that the current view controller could pick up, and the view controllers register and unregister as they are shown / hidden. This could also be done by the current view controller registering with the playback delegate (assuming there can only be one view controller interested at a time or the implementation is overly fussy).

Wain
  • 118,658
  • 15
  • 128
  • 151