Beginning using Drupal and TokBox

I’ve been playing around with TokBox and the Drupal plugin (7 only) for a project to see where it can go. TokBox is a video API which can be used to set up video sessions, say to publish only like a lecture, or to have a conversation and to link people together.

Reading the University Flipped article in the May 2012 edition of Wired UK got me thinking about what video technology really begins to achieve. Combined with other forms of technology, the classroom can be transformed and collaboration made easier and quicker. Which is not to say that email does not have its place as it does. Its position as the dominant method of communication has waned, especially with smart phones.

Anyhow, I have been playing with TokBox as a way of exploring video as it is a fairly new medium to use for developing.

One of the issues is the lack of documentation so some of this will be patchy as I am still new to the system.

I downloaded the OpenTok plugin using Drush. The plugin has a few requirements but it sets up a session field in a node, or nodes. It requires clean urls being enabled, the Libraries module, json-js (you will need to rename the file to json2.js and put it into the /sites/all/libraries), and JM Torres’s jquery-opentok (again it will need renaming to jquery-opentok and placed in the same library as json2.js).

A world of warning here. This plugin fails with non-clean urls. This is apparently being looked at, but there is a way of hacking around the problem. It is messy but it does work. The session variable will not be loaded or called by the plugin so you get the grey box in the screen which will not do anything. I need to find a better way of doing this but for the moment, one copy of Drupal has the opentok_field_formatter_view() adapted to call $item[‘session’] to re-assign the session. This may have unintended consequences and the other Drupal copy that I have with clean urls does not need this bodge. (Update: it recreates the session so you can end up with quite a few screens of yourself on one page which is great for solo Mexican waves but not as good if you are playing nicely with Tokbox’s API or you don’t multiple visions of yourself.)

In admin/config/media/opentok, put in the OpenTok key and session id which you can generate from the TokBox API page. Save this and also tick the staging server option which allows you to use the staging server rather than production.

Either create a node or add the Opentok session field to an existing node. For instance you could create a chat node which allows you to chat to any one who is online. (One of the things that I want to look at is how to combine this with presence data.) Or you could create a page to give a talk from and viewers just subscribe to the stream.

Whilst the plugin comes with a UI, it does require a fair amount of work. It is very basic but a little retheming can improve it no end. I’ve just come across a patch to add a show/hide button which I am in the process of trying out. (Update: Installing it and it does  anice job of adding some jQuery to show/hide the box on the page but it is not quite what I am looking for at the moment.) The CSS is the next task to take on and to play with concept map I have been using to map out potential user needs.

There is a long way to go but with some digging, this plugin does appear to be useful in getting set up quickly with video.