The vast majority of notebooks have a webcam built-in. Why not take advantage of this built-in video camera by using Viddler’s webcam recorder? Here is how you do it.

The simple workflow to initiate a recording session using Viddler’s API and the embeddable flash video recorder:

  1. Authenticate the user account you want to save the recorded video to using the viddler.users.auth method with the get_record_token argument set to “1″.
  2. Use the record_token returned by this method to embed the Flash video recorder on the page.
  3. The recorder will launch so that you can record a video.
  4. After recording is finished the embedded Flash video recorder will call a JavaScript function (see below) which you can use to notify your app when the recording is finished.

Here is the embed code for embedding the Flash video recorder on to the page. Notice the recordToken flashvar that needs to be edited for every single video recording session.

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"  codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="449" height="545"
id="viddler_recorder" align="middle"> <param name="allowScriptAccess" value="always" /> <param name="allowNetworking" value="all" /> <param name="movie" value="http://cdn-static.viddler.com/flash/recorder.swf" /> <param name="quality" value="high" /> <param name="scale" value="noScale"> <param name="bgcolor" value="#000000" /> <param name="flashvars" value="fake=1&recordToken=[YourRecordTokenHere]" /> <embed src="http://cdn-static.viddler.com/flash/recorder.swf" quality="high" scale="noScale" bgcolor="#000000"
allowScriptAccess="always" allowNetworking="all" width="449" height="545" name="viddler_recorder"
flashvars="fake=1&recordToken=[YourRecordTokenHere]" align="middle" allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"  pluginspage="http://www.macromedia.com/go/getflashplayer" /> </object>

Using any of the API Wrappers available in our Project Directory will make generating this Flash video recorder’s embed code a snap.

Additional Flashvars

There are several additional flashvars that you can include in your embed code to enable more features.

  • permalink(url) URL that will be saved with the recorded video as its permalink.
  • maxlength(integer) will limit the length of video able to be recorded.
  • audioOnly(“Y”, “1″, “T”) will turn video off, saving only the audio.
  • recQuality(“H”, “M”, “L”) (High, Medium, Low) if set, the recording quality selector is not shown.
  • enableCallbacks(“Y”,”1″,”T”) – will enable additional JavaScript callbacks during operation.

Javascript Callbacks

There are a few JavaScript callbacks that can be used. Some need to be turned on with enableCallbacks flashvar, some are called by default.

recordStarted() – When the user clicks record.

function recordStarted() { }

The JavaScript function that is called after the recording is completed and saved is recordDone():

recordDone() – When the recording is finished and saved to the server.

function recordDone(username,user_video_number,video_id) {
// handle record data
}

username is the Viddler username, user_video_number is the number in the URL (eg. http://viddler.com/explore/cdevroe/videos/NUMBER/), video_id is the video ID.

Additional callbacks

Other JavaScript callbacks that are available (when enableCallbacks is turned on) are:

recordStopped – When the user stops the recording.

function recordStopped() { }

recordDeleted – When the user decides to delete the recorded footage and re-record.

function recordDeleted() { }

recordSave – When the user clicks “Save”. This action is before the video is actually saved to the server. That is when recordDone() is called.

function recordSave() { }

Important: You may use each record_token only one time. Once the flash video recorder launches the token is immediately invalidated. If a record_token is invalid, an error will display.