changed refs to video to videoObj + fixed video pause

This commit is contained in:
sanj 2010-11-06 22:16:51 +05:30
parent 91047e7511
commit 7e9cf186dd

24
test.js
View File

@ -8,26 +8,26 @@ $(function() {
$('#essay').css("width", essayWidth); $('#essay').css("width", essayWidth);
}); });
function setupPadmaLink(video, data) { function setupPadmaLink(videoObj, data) {
var $a = $(data.jq); var $a = $(data.jq);
// $a.data("isDisplayed", false); // $a.data("isDisplayed", false);
var linkData = data.linkData; var linkData = data.linkData;
//FIXME: put this as a variable, option somewhere? //FIXME: put this as a variable, option somewhere?
var $container = padmaContainer; var $container = padmaContainer;
video.currentLayers = []; videoObj.currentLayers = [];
switch (linkData.type) { switch (linkData.type) {
case "tcRange": case "tcRange":
var mid_frame_npt = ms2npt(parseInt((npt2ms(linkData.tcIn) + npt2ms(linkData.tcOut)) / 2)); var mid_frame_npt = ms2npt(parseInt((npt2ms(linkData.tcIn) + npt2ms(linkData.tcOut)) / 2));
// console.log(mid_frame_npt); // console.log(mid_frame_npt);
var thumbUrl = video.getFrame(mid_frame_npt); var thumbUrl = videoObj.getFrame(mid_frame_npt);
default: default:
var frame_npt = ms2npt(video.video.poster_frame); var frame_npt = ms2npt(videoObj.video.poster_frame);
var thumbUrl = video.getFrame(frame_npt); var thumbUrl = videoObj.getFrame(frame_npt);
} }
//FIXME: Html may need to be conditional on linkData.type, probably put html in switch case above. //FIXME: Html may need to be conditional on linkData.type, probably put html in switch case above.
var html = tmpl("tmpl_tooltip", {'video': video, 'thumbUrl': thumbUrl, 'linkData': linkData}); var html = tmpl("tmpl_tooltip", {'video': videoObj, 'thumbUrl': thumbUrl, 'linkData': linkData});
// $a.attr("title", title); // $a.attr("title", title);
$a.tooltip({ $a.tooltip({
bodyHandler: function() { bodyHandler: function() {
@ -73,7 +73,7 @@ function setupPadmaLink(video, data) {
// sidebarAnimateIn(); // sidebarAnimateIn();
e.preventDefault(); e.preventDefault();
var currentVideo = $container.data("currentVideo"); var currentVideo = $container.data("currentVideo");
if (currentVideo == video) { if (currentVideo == videoObj) {
/* /*
if (!isSidebarVisible()) { if (!isSidebarVisible()) {
sidebarAnimateIn(); sidebarAnimateIn();
@ -84,16 +84,16 @@ function setupPadmaLink(video, data) {
if (currentVideo) { if (currentVideo) {
cleanupVideo(currentVideo); cleanupVideo(currentVideo);
} }
$container.data("currentVideo", video); $container.data("currentVideo", videoObj);
if (!isSidebarVisible()) { if (!isSidebarVisible()) {
sidebarAnimateIn(); sidebarAnimateIn();
} }
var html = tmpl("tmpl_sidebar", {'video': video, 'linkData': linkData}); var html = tmpl("tmpl_sidebar", {'video': videoObj, 'linkData': linkData});
$('#padmaSidebarWrapper').html(html); $('#padmaSidebarWrapper').html(html);
$('#aboutTxt').hide(); $('#aboutTxt').hide();
//FIXME: should be a better way to deal with displaying default layer. //FIXME: should be a better way to deal with displaying default layer.
var currentLayers = video.getLayersAtTimecode(npt2ms(linkData.tcIn)); var currentLayers = videoObj.getLayersAtTimecode(npt2ms(linkData.tcIn));
var transcripts = filterLayersByTracks(currentLayers, ['transcript']); var transcripts = filterLayersByTracks(currentLayers, ['transcript']);
// console.log(transcripts); // console.log(transcripts);
@ -112,7 +112,7 @@ function setupPadmaLink(video, data) {
.text("x") .text("x")
.appendTo('.padmaViewer'); .appendTo('.padmaViewer');
var videoElem = $('video'); var videoElem = $('video');
var videoObj = video; // var videoObj = video;
videoElem.bind("play", function() { videoElem.bind("play", function() {
var that = this var that = this
@ -147,7 +147,7 @@ function setupPadmaLink(video, data) {
//FIXME: actually handle the cleanups. //FIXME: actually handle the cleanups.
// parameter is a padmaVideo object. // parameter is a padmaVideo object.
function cleanupVideo(video) { function cleanupVideo(video) {
$('video').pause(); $('video')[0].pause();
// clearInterval(video.interval); // clearInterval(video.interval);
$('.padmaViewer').remove(); $('.padmaViewer').remove();