2

I have asked a related question before

OpenTok - How to publish/unpublish manually?

Now I am struggling to do the unsubscribe manually.

http://www.tokbox.com/opentok/api/tools/js/documentation/api/Session.html#unsubscribe

I have already followed the code but I still see the video. It is supposed to remove the video right?

EDIT: I discovered a mistake in the example code in the unsubscribe section. unsubscribe() accepts subscriber objects but the code passes a stream object.

Community
  • 1
  • 1
developarvin
  • 4,940
  • 12
  • 54
  • 100

1 Answers1

3

In case anyone else has the some error, heres some sample code snippet:
var subscriber;

After you create a subscriber:
subscriber = session.subscribe( streamObject );

To unsubscribe:
session.unsubscribe(subscriber);

songz
  • 2,082
  • 1
  • 14
  • 18
  • it works. sadly, the documentation says the object you should pass to unsubscribe is the stream object – Moshe Shaham Feb 14 '18 at 09:11
  • Yep, 2019 and the documentation still states to pass the stream and not the subscriber. – Eldelshell Aug 28 '19 at 11:52
  • 1
    @Eldelshell I looked up the documentation and it says `subscriber` now. Perhaps the explanation could be better. Source: https://tokbox.com/developer/sdks/js/reference/Session.html#unsubscribe – songz Sep 23 '19 at 20:43