Skip to content

Commit

Permalink
resizing change
Browse files Browse the repository at this point in the history
  • Loading branch information
NSavenije committed Dec 24, 2021
1 parent e492044 commit 07f7e92
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 28 deletions.
Expand Up @@ -41,7 +41,7 @@ this.loadMedia = function($holder, mediaType, mediaData, mainMedia = true) {
|| mediaData.media.indexOf('vimeo') > 0
|| mediaData.media.indexOf('mediamission') > 0) {
popcornInstance = Popcorn.smart("#" + $holder.attr("id") + " .popcornMedia", mediaData.media);
var $videoHolder = $holder.find(".popcornMedia").addClass(popcornInstance.media._util.type);
var $videoHolder = $holder.find(".popcornMedia").addClass(popcornInstance.media._util.type).addClass("embed");
$videoHolder.attr("aspect", mediaData.aspect);
$videoHolder.data("popcornInstance", popcornInstance);
if (mediaData.autoplay == "true") {
Expand Down
Expand Up @@ -44,7 +44,7 @@
$("#pageContents").data("mediaElement").setCurrentTime(0);
}

$(".YouTube, .Vimeo").each(function() {
$(".embed").each(function() {
$(this).data("popcornInstance").pause();
});

Expand Down Expand Up @@ -168,16 +168,8 @@
$popcornMedia.next().width($popcornMedia.width());
}
});
$(".popcornMedia.YouTube").each(function(i) {
mediaLesson.resizeYouTube($(this));
});

$(".popcornMedia.Vimeo").each(function(i) {
mediaLesson.resizeVimeo($(this));
});

$(".popcornMedia.Mediasite").each(function(i) {
mediaLesson.resizeMediasite($(this));
$(".popcornMedia.embed").each(function(i) {
mediaLesson.resizeEmbededMedia($(this));
});

$(".audioImg").each(function() {
Expand Down Expand Up @@ -248,8 +240,8 @@
}
};

this.resizeYouTube = function($youTube) {
var $holder = $youTube.parent(),
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)
Expand All @@ -272,37 +264,27 @@
h = hh;
}

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

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

this.resizeVimeo = function($vimeo) {
this.resizeYouTube($vimeo);
var h = $vimeo.width() / 16 * 9;
$vimeo.css({"height": h});
};

this.resizeMediasite = function($mediasite) {
this.resizeYouTube($mediasite)
};

this.leavePage = function () {
currSegment.end = lastTime;
this.addSegment(currSegment);
$(".YouTube, .Vimeo").each(function() {
$(".embed").each(function() {
$(this).data("popcornInstance").pause();
});
if (this.popcornInstance != null)
Expand Down

0 comments on commit 07f7e92

Please sign in to comment.