Opentok Windows SDK Graceful shutdown

Did anyone manage to close a WPF window containing an OpenTok session running with the Windows SDK without making the entire application to abruptly terminate?

I am trying to set up an application where a person can attend multiple conferences, one after another, but the only way I seem to manage to make everything working is by hiding the OpenTok window instead of closing it and then by recreating Session, Publisher and Subscriber objects. This kinda works, but it seems a pretty dirty workaround...

If you want to see the code, I started from the BasicVideoChat sample available here https://github.com/opentok/opentok-windows-sdk-samples/tree/master/BasicVideoChat: then I just added a new window with a button, set it as the default application starting point, and added a button that, on click, opens a new opentok client in the most trival possible way:

MainWindow mw = new MainWindow();
mw.ShowDialog();

I have tried to make the session shutdown more graceful by adding this code in the Closing() event:

foreach (Subscriber b in sublist) {
 Session.Unsubscribe(b);
 b.Dispose();
}
Session.Unpublish(Publisher);
Publisher.Dispose();

Session.Disconnect();
Session.Dispose();

But nothing changed, as soon as I close the videoconference page the entire application dies with a weird return code.

Has anyone already tried something similar?

链接地址: http://www.djcxy.com/p/66148.html

上一篇: 如何获得YouTube JSON GData网址

下一篇: Opentok Windows SDK平稳关机