Skip to content

Commit

Permalink
removed old medialesson resize code and generic event test
Browse files Browse the repository at this point in the history
  • Loading branch information
NSavenije committed Jan 2, 2022
1 parent b7117ed commit 7ac8ea6
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 45 deletions.
Expand Up @@ -162,8 +162,6 @@ this.resizeEmbededMedia = function($video, {ratio = 16 / 9, width, height}) {
var w = ww < hw ? ww : hw;
var h = ww < hw ? wh : hh;

debugger;

if(!$video[0].getAttribute("aspect") && !$video.hasClass("mainMedia"))
{
w = "100%";
Expand All @@ -179,4 +177,24 @@ this.resizeEmbededMedia = function($video, {ratio = 16 / 9, width, height}) {
"min-width" : 150,
"min-height": 120
});
};
};

this.addEvents = function(popcornInstance) {
popcornInstance.on( "pause", function() {
var popTime = popcornInstance.currentTime();
//vidFullWatched.time = popTime;
console.log("Pause : " + popTime);
//isPlaying = false;

//currSegment.end = popTime;
//mediaLesson.addSegment(currSegment);
//currSegment = {
// start: popTime,
// end: -1
//};
//vidFullWatched.duration = mediaLesson.popcornInstance.duration();
duration = popcornInstance.duration();
XTVideo(x_currentPage, trackinglabel, "", "paused", vidFullWatched, x_currentPageXML.getAttribute("grouping"));
debugger;
});
}
Expand Up @@ -168,8 +168,11 @@
$popcornMedia.next().width($popcornMedia.width());
}
});
var ratio = 16 / 9;
if ($(x_currentPageXML).children("mediaPanel").attr("aspectRatio") != undefined)
ratio = parseFloat($(x_currentPageXML).children("mediaPanel").attr("aspectRatio"));
$(".popcornMedia.embed").each(function(i) {
mediaLesson.resizeEmbededMedia($(this));
resizeEmbededMedia($(this), {ratio: ratio});
});

$(".audioImg").each(function() {
Expand Down Expand Up @@ -240,47 +243,6 @@
}
};

this.resizeEmbededMedia = function($video) {
var $holder = $video.parent(),
ratio = 16 / 9; // assume videos are 16:9 ratio

if ($(x_currentPageXML).children("mediaPanel").attr("aspectRatio") != undefined)
{
ratio = parseFloat($(x_currentPageXML).children("mediaPanel").attr("aspectRatio"));
}
var ww = $holder.width(),
wh = Math.floor(ww / ratio),
hh = $holder.height() - $holder.find(".panelTitle").outerHeight(true),
hw = Math.floor(hh * ratio);

if (ww < hw)
{
w = ww;
h = wh;
}
else
{
w = hw;
h = hh;
}

if(!$video[0].getAttribute("aspect") && !$video.hasClass("mainMedia"))
{
w = "100%";
h = "100%";
$video.parent().css({
"height": "100%"
});
}

$video.css({
"width": w,
"height": h,
"min-width" : 150,
"min-height": 120
});
};

this.leavePage = function () {
currSegment.end = lastTime;
this.addSegment(currSegment);
Expand All @@ -305,6 +267,10 @@
var progress = XThelperDetermineProgress(vidFullWatched) * 100.0;
XTVideo(x_currentPage, trackinglabel, "", "exit", vidFullWatched, x_currentPageXML.getAttribute("grouping"));
};

this.loadMedia = function($holder, type, data) {
loadMedia($holder, type, data);
}

this.init = function() {
this.panelbaseid = "panel_" + x_currentPage + '_';
Expand Down
Expand Up @@ -200,6 +200,8 @@
audioImage: undefined,
audioImageTip: ""
}, true);

addEvents(this.popcornInstance);

//controls toggle
$(".panel.inline.x_floatRight")
Expand Down

0 comments on commit 7ac8ea6

Please sign in to comment.