millicast / millicast-native-sdk

SDK to build native clients using the Millicast platform.
Other
17 stars 5 forks source link

Video track and Audio track are not updated if credentials are changed for Subscriber. #29

Open akryzhanovskiy opened 1 month ago

akryzhanovskiy commented 1 month ago

Can you please help with next situation with subscribing:

  1. We initialize MCSubscriber with delegate
  2. We set credentials for subscriber
  3. Then we call subscriber.connect() and subscriber.subscribe()
  4. After that we receive video and audio tracks with delegate method

func subscriber(_ subscriber: MCSubscriber, didReceiveRTSRemoteTrack rtsRemoteTrack: MCRTSRemoteTrack) { if let videoTrack = rtsRemoteTrack.asVideo(), let renderer = videoRenderer { videoTrack.enable(renderer: renderer) { [weak self] error in self?.videoTrack = videoTrack self?.videoTrack?.delegate = self } } else if let audioTrack = rtsRemoteTrack.asAudio() { audioTrack.enable { [weak self] error in self?.audioTrack = audioTrack } } }

  1. Then we try to another stream, so we call subscriber.unsubscribe() and subscriber.disconnect()
  2. Change credentials (streamName and token)
  3. And call subscriber.connect() and subscriber.subscribe() one more time.

And at this point we get callbacks that we connected and subscribed successfully, but delegate method didReceiveRTSRemoteTrack is not called, so video track and audio track are not updated and we still see video from the first stream.

Can you please tell what is wrong with this flow?

akryzhanovskiy commented 1 month ago

@djova-dolby @Yousif-CS can you please take a look?

Yousif-CS commented 1 month ago

HEy @akryzhanovskiy Thanks for reporting this. Just want to make sure, did you verify credentials are set properly the second time around?

akryzhanovskiy commented 1 month ago

@Yousif-CS yes, credentials are set correctly.

Yousif-CS commented 1 month ago

Hi @akryzhanovskiy we were able to replicate the issue on our end. I am hoping to get a fix for it in the 2.1.0 SDK which is coming out soon. In the meantime, are you able to recreate the subscriber instance when attempting to connect to a different stream?

One important point to mention is that you will need to get rid of any references to MCRTSRemoteTrack in your app when you destroy MCSubscriber, since their lifetime depends on MCSubscriber.

akryzhanovskiy commented 1 month ago

@Yousif-CS yes, this is the way I'm doing right now. I have to remove subscriber and then initialise new one.

Thank you for your response. Hope this issue will be fixed next release.