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);
});
function setupPadmaLink(video, data) {
function setupPadmaLink(videoObj, data) {
var $a = $(data.jq);
// $a.data("isDisplayed", false);
var linkData = data.linkData;
//FIXME: put this as a variable, option somewhere?
var $container = padmaContainer;
video.currentLayers = [];
videoObj.currentLayers = [];
switch (linkData.type) {
case "tcRange":
var mid_frame_npt = ms2npt(parseInt((npt2ms(linkData.tcIn) + npt2ms(linkData.tcOut)) / 2));
// console.log(mid_frame_npt);
var thumbUrl = video.getFrame(mid_frame_npt);
var thumbUrl = videoObj.getFrame(mid_frame_npt);
default:
var frame_npt = ms2npt(video.video.poster_frame);
var thumbUrl = video.getFrame(frame_npt);
var frame_npt = ms2npt(videoObj.video.poster_frame);
var thumbUrl = videoObj.getFrame(frame_npt);
}
//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.tooltip({
bodyHandler: function() {
@ -73,7 +73,7 @@ function setupPadmaLink(video, data) {
// sidebarAnimateIn();
e.preventDefault();
var currentVideo = $container.data("currentVideo");
if (currentVideo == video) {
if (currentVideo == videoObj) {
/*
if (!isSidebarVisible()) {
sidebarAnimateIn();
@ -84,16 +84,16 @@ function setupPadmaLink(video, data) {
if (currentVideo) {
cleanupVideo(currentVideo);
}
$container.data("currentVideo", video);
$container.data("currentVideo", videoObj);
if (!isSidebarVisible()) {
sidebarAnimateIn();
}
var html = tmpl("tmpl_sidebar", {'video': video, 'linkData': linkData});
var html = tmpl("tmpl_sidebar", {'video': videoObj, 'linkData': linkData});
$('#padmaSidebarWrapper').html(html);
$('#aboutTxt').hide();
//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']);
// console.log(transcripts);
@ -112,7 +112,7 @@ function setupPadmaLink(video, data) {
.text("x")
.appendTo('.padmaViewer');
var videoElem = $('video');
var videoObj = video;
// var videoObj = video;
videoElem.bind("play", function() {
var that = this
@ -147,7 +147,7 @@ function setupPadmaLink(video, data) {
//FIXME: actually handle the cleanups.
// parameter is a padmaVideo object.
function cleanupVideo(video) {
$('video').pause();
$('video')[0].pause();
// clearInterval(video.interval);
$('.padmaViewer').remove();