Switch facingMode in opentok during a session - opentok

Is it possible to switch the facingmode of your camera in the middle of an opentok session? I can set the facing mode when the session starts with publisherOptions but if I need to switch the facingmode of the camera during the session the only way I can see you can do it is to disconnect the session and start a new one.

I've found the answer. You just use
publisher.cycleVideo();
and cycles between front and back cameras.

Related

Opentok MediaMode::ROUTED alwyas disconnect

I have two users who joins a MediaMode::ROUTED Session. Both users PUBLISHES their cameras and microphones and SUBSCRIBES to the corresponding PUBLISHED video feed. I'm building a web app that can be used for communication using your Opentok.js.
My current JavaScript codes follows the idea of the AutomaticReconnection (discussed on this URL: https://tokbox.com/developer/guides/connect-session/js/#automatic_reconnection).
Note that the users who are testing my codes are in different countries (e.g. in Amsterdam - Netherlands and in the Philippines). Neither of the users triggers the 'disconnect()' method of the Session - we have a "STOP" button that triggers the 'disconnect()' Session method. And with several tests that we did, the test users' Session always gets the 'clientDisconnected' event. I have used Tokbox Session Inspector and it has been consistent that I see 'clientDisconnected' as the cause of our Session disconnection.
Based on the documentation:
"clientDisconnected" — A client disconnected from the session by calling the disconnect() method of the Session object or by closing the browser. ( See Session.disconnect().)
Why do our test users always get 'clientDisconnected' with my MediaMode::ROUTED session?
What could be the possible cause of this?
Regards,
It's hard to explain this behaviour without more information such as the code you use to connect/publish/subscribe.
It may be easier if you create a TokBox support ticket at https://support.tokbox.com/hc/en-us/requests/new and include the relevant session ID and connection IDs so the server side logs can be examined.

Chromecast sender that knows when session started from Cast Extension

The SDK docs for building a Chromecast Sender on Chrome mention this:
There is also a third way of getting a Cast session. A user with the
Cast extension installed in their Chrome browser can mirror any Chrome
tab to a Cast device. If the user lands on your site, for which you
have implemented a Cast app, tab mirroring will automatically trigger
a new Cast session instead of putting the browser in mirroring mode.
And this works just fine; however, I'd like to better understand how my sender code can know when a session has been started this way. Normally, when we set up our own trigger to start a session (i.e. the cast icon), we pass as an argument the callback that will execute when the session connection is ready, If someone visits my app and launches the Cast session directly from the extension, then, how can my app be notified? Is there an event that's raised? Does it execute its own callback (and if so, how can we hook into that callback)?
A similar question was asked here at SO a while ago, and Leon Nicholls answered indicating that it was possible, but not how to do it. Any insights woyld be very useful.

Reacting to UserAction in AudioPlayerAgent when app is suspended

I have an audio player that uses BackgroundAudioPlayer together with AudioPlayerAgent. Everything is working fine, except there's one use case I don't know how to handle.
If I play an audio track in my application and then the user switches to another application, the audio track continues to play in the background as it should - but I guess my application has now been swapped to memory and is suspended.
My question is: if the user now starts to play music in another app, I do get the AudioPlayerAgent.UserAction.Stop action as a callback to my AudioAgent. But can I do anything about this now from my app's point of view? I mean, I would like to save the position of the audio playback where the user was in my app, but my app has been suspended, right?
When my app is in the foreground and the audio stops, I do get the BackgroundAudioPlayer.Instance.PlayerState.Stopped event. It's here that I normally save the position of the playback. But if the user switches to another app to play music, I don't get this event.
So I am just wondering how to handle this kind of case. Is there anything I can do to improve the user experience?
The only way is to save that Position to Isolated Storage in the agent code.
See this very useful article of Paul about how to use Background audio agent and the way to communicate between UI and agent side

How to work with background application?

I have created an app that triggers video at particular time similar to alarm, but the problem I am facing is that when I am out of application & have set the timings the video doesn't show up(i.e. similar to alarm I should get notification out side my app). Please help me out with the same. Would be very grateful for any helpful suggestion.
When an application is not running, you cannot predict what time its background process will execute, so there is no way that you can set an alarm with any degree of precision smaller than perhaps an hour. The only way to have timing close to accurate would be with a push notification from a server. Even then, the notification you receive will not be able to open and play video on its own. You could create a push/toast notification that originates at a server, sends the user a toast, the user taps it, and that opens the app to play the video. You can't do it without user intervention.
See this link for an overview, including the constraints on background agents: http://msdn.microsoft.com/en-us/library/hh202942(v=VS.92).aspx
You cannot open an app and play a video from a background agent. You can show a toast notification that would allow the user to open the app. You can use a Scheduled Agent or PeriodicTask.You can then use the ShellToast to show a toast notification so the user can open the app. Once the app is open you can start the video.

Keeping Session and Conversation alive in Seam

I have a problem with the way sessions and conversations are handled in Seam. We have some rather long forms where most of the time you start filling in the first screen and then some actions are executed in the background and the users leave the computer to do some work, and then later they come back and annotate the work.
Problem is that most of the time the sessions time out or the conversations timed out. While the second one can be easily fixed by splitting the workflow, the first is more important, since the user has to log back in, navigate to the right screen and only then can enter the annotation.
Is there a simple way to have a snippet of Ajax that would trigger a refresh of the session in the background. This would allow us to keep the sessions alive indefinitely.
Also is there an easy way to keep conversations alive?
Are you using RichFaces? We use something like this to keep the session alive.
<a4j:poll interval="10000" reRender="form1" action="#{logger.userIsAlive}" />
The "action" attribute is optional, we use it to keep a record of the connected users. We don't use conversations but I would say that this would also keep the conversation alive.
If you are not using RichFaces, then you could use an AJAX framework like JQuery to ping the server by calling a Servlet for example.

Resources