private void unsubscribeFromStream(Stream stream) { mStreams.remove(stream); if (mSubscriber.getStream().getStreamId().equals(stream.getStreamId())) { mSubscriberViewContainer.removeView(mSubscriber.getView()); mSubscriber = null; if (!mStreams.isEmpty()) { subscribeToStream(mStreams.get(0)); } } }