Expand my Community achievements bar.

AudioSubscriber and publisherIDs

Avatar

Level 4

i'm allowing individual on/off controls for listening to users' audio streams.

AudioSubscriber.publisherIDs is the way to control which streams you're playing. by default it's set to empty which plays all audio streams.

to stop playing an audio stream, you remove that stream's publisher id from .publisherIDs - but first you have to populate it with all of the ids that you *do* want to play.  i can manage that.

what i'm confused about is what to do when you don't want to play anyone's stream - setting .publisherIDs to empty would play all of the streams according to the docs.  in that case, should i use AudioSubscriber.close() , and then recreate an AudioSubscriber instance and use .subscribe() when i want to start playing one or more streams again?

3 Replies

Avatar

Former Community Member

Hi Adam,

Yeah, I think what you've got planned is the way to go. I was kinda wishing

that you could call close(), then just call subscribe() again on the same

instance once you wanted to start listening again, but from the code, it

doesn't seem like we support that. I'm filing a bug so that gets improved

for the next release.

Hope that helps

nigel

Avatar

Level 4

thanks for the reply nigel and the bug report.  good to know our feedback is taken into consideration.

i'm using a slightly different approach now, instead of having to recreate instances and do subscribe() again.  when i don't want any audio streams to be played, i just populate .publisherIDs with one fake publisherID name.  it seems to be working well and i avoid the reinstantiating work.

Avatar

Former Community Member

Hi Adam,

This issue has been fixed and will be updated in the next release.

Thanks for bringing it up.

Regards

Hironmay Basu