When building OpenTok apps, there might be cases where you would like the videos inside a container to automagically resize to take up the largest resolution possible within the boundaries of their container. With layout container, an open sourced library available on github, you can do exactly that.
After including the library in your project, you can simply call ResizeLayoutContainer() whenever you need to resize the elements within the container. ResizeLayoutContainer takes in an object parameter with the following properties: selector for container and selector for the elements you would like to resize.
The element property defaults to work with OpenTok video streams, so the only important property you need to pass into the function is the container selector. Here are some sample codes:
If you have read through our getting started tutorial and know how to create sessions and tokens, you are good to go!
To get you started, we have a few simple and working video chat sample apps to get you started:
For more complicated features and functionalities, check out these demo apps:
If you have read our Getting Started With OpenTok: From 0 to group video chat, you will see why we need to create sessions and their corresponding tokens.
Since creating sessions and generating its corresponding tokens involves your developer api key and secret, they should always be executed in your server to prevent your credentials from being exposed.
In short, sessions are like rooms. People connected to the same session Id will be able to publish and subscribe to each other’s video stream. Session Ids exist forever, so it’s safe to store them in the database.
TokBox is the company that provides the video streaming API called OpenTok. This tutorial will be a walk through to creating a very simple group video chat application.
There are two flavors to the OpenTok API, OpenTok Flash that uses flash plugin and OpenTok WebRTC that uses the new and cool HTML 5 technology, and they are not interoperable.
WebRTC provides a much better video chat experience when it comes to quality but is currently only supported officially in Firefox and Chrome. Internet Explorer users must install Chrome Frame plugin.
Flash on the other hand, is supported in 99% of all browsers and allows the ability to record live video streams as they occur (archiving).
This tutorial will show you how to create a simple, yet functional video chatroom using the OpenTok API and Sinatra. Sinatra is a Ruby framework which allows you to quickly create web apps.
The app we’ll be creating will be a simple website which will allow you to instantly create a video chatroom.
So, let’s get started! First of all, you’ll need to install Sinatra. To do this, type the following command in the terminal:
gem install sinatra
Then, create a new folder and inside, make a new file called app.rb.