2012-12-12 05:54:51 +08:00
|
|
|
(function(window, undefined) {
|
|
|
|
|
|
|
|
var CAM_PREVIEW = {};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal function to get the BBB embed object. Seems like we have to do this
|
|
|
|
* each time and can't create a var for it.
|
|
|
|
*
|
|
|
|
* To get the object, see https://code.google.com/p/swfobject/wiki/api
|
|
|
|
*/
|
|
|
|
function getSwfObj() {
|
|
|
|
return swfobject.getObjectById("WebcamPreviewStandalone");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Preview user's webcam.
|
|
|
|
*/
|
2012-12-15 04:03:30 +08:00
|
|
|
CAM_PREVIEW.previewCamera = function(camIndex, camWidth, camHeight,
|
|
|
|
camKeyFrameInterval, camModeFps,
|
2013-05-25 23:55:13 +08:00
|
|
|
camQualityBandwidth, camQualityPicture, avatarURL) {
|
2012-12-15 04:03:30 +08:00
|
|
|
console.log("CAM_PREVIEW::previewCamera [" + camIndex + "]");
|
2012-12-12 05:54:51 +08:00
|
|
|
var swfObj = getSwfObj();
|
|
|
|
if (swfObj) {
|
2012-12-15 04:03:30 +08:00
|
|
|
swfObj.startPreviewCamera(camIndex, camWidth, camHeight, camKeyFrameInterval, camModeFps,
|
2013-05-25 23:55:13 +08:00
|
|
|
camQualityBandwidth, camQualityPicture, avatarURL);
|
2012-12-12 05:54:51 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Stop previewing user's webcam.
|
|
|
|
*/
|
2013-05-25 23:55:13 +08:00
|
|
|
CAM_PREVIEW.stopPreviewCamera = function(avatarURL) {
|
2012-12-12 05:54:51 +08:00
|
|
|
var swfObj = getSwfObj();
|
|
|
|
if (swfObj) {
|
2013-05-25 23:55:13 +08:00
|
|
|
swfObj.stopPreviewCamera(avatarURL);
|
2012-12-12 05:54:51 +08:00
|
|
|
}
|
|
|
|
}
|
2012-12-15 04:03:30 +08:00
|
|
|
|
|
|
|
console.log("CAM_PREVIEW INITIALIZED");
|
2012-12-12 05:54:51 +08:00
|
|
|
|
|
|
|
window.CAM_PREVIEW = CAM_PREVIEW;
|
|
|
|
})(this);
|
|
|
|
|