Skip to content

Commit

Permalink
Changed the jplayer skin, added forward and rewind option, scroll to …
Browse files Browse the repository at this point in the history
…player and minor design improvements
  • Loading branch information
smntb committed Jul 6, 2017
1 parent 96462f4 commit 1cde7b9
Show file tree
Hide file tree
Showing 17 changed files with 1,287 additions and 124 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
config/config.ini
viewerfiles
cachefiles
viewerfiles/*
cachefiles/*
.htaccess
.idea/
.DS_store
Expand Down
10 changes: 7 additions & 3 deletions css/viewer.css
Original file line number Diff line number Diff line change
Expand Up @@ -680,8 +680,8 @@ input {
.toggle-txt-info{vertical-align: top;
display: inline-block;
margin-top: 10px;
margin-right: 15px;
margin-left: 15px;
margin-right: 3%;
margin-left: 3%;
font-weight: bold;
}
@media only screen and (min-width: 769px) and (max-width: 1000px) {
Expand All @@ -706,7 +706,7 @@ input {
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.kw-empty{height: 26px;}
.kw-empty{height: 26px;max-width:100% !important }
#subjectPlayer{width: 100% !important;}
.show-info{display: inline-block}
.detail-metadata{display: none;}
Expand Down Expand Up @@ -886,4 +886,8 @@ input:checked + .slider:before {

.nline li {
display: grid;
}

div.jp-current-time, div.jp-duration {
text-align: left;
}
19 changes: 19 additions & 0 deletions js/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,23 @@ jQuery(document).ready(function ($) {

});

$(".jp-next").bind('click', function () {
var currentProgress = Math.floor(jQuery('#subjectPlayer').data("jPlayer").status.currentTime);
var futureProgress = currentProgress + 15;
if (futureProgress <= 0) {
$("#subjectPlayer").jPlayer("pause", 0);
} else {
jQuery('#subjectPlayer').jPlayer("play", futureProgress);
}
});
$(".jp-previous").bind('click', function () {
var currentProgress = Math.floor(jQuery('#subjectPlayer').data("jPlayer").status.currentTime);
var futureProgress = currentProgress - 15;
if (futureProgress <= 0) {
$("#subjectPlayer").jPlayer("pause", 0);
} else {
$("#subjectPlayer").jPlayer("play", futureProgress);
}
});

});
83 changes: 42 additions & 41 deletions js/viewer_kaltura.js
Original file line number Diff line number Diff line change
@@ -1,43 +1,44 @@
jQuery(function ($) {
var loaded = false;



$('#translate-link').click(function (e) {
var urlIndexPiece = '';
var re;
e.preventDefault();
if ($('#search-type').val() == 'Index') {
var activeIndexPanel = $('#accordionHolder').accordion('option', 'active');
if (activeIndexPanel !== false) {
urlIndexPiece = '&index=' + activeIndexPanel;
}
}
if ($('#translate-link').attr('data-lang') == $('#translate-link').attr('data-linkto')) {
re = /&translate=(.*)/g;
location.href = location.href.replace(re, '') + '&time=' + Math.floor(kdp.evaluate('{video.player.currentTime}')) + '&panel=' + $('#search-type').val() + urlIndexPiece;
} else {
re = /&time=(.*)/g;
location.href = location.href.replace(re, '') + '&translate=1&time=' + Math.floor(parent.kdp.evaluate('{video.player.currentTime}')) + '&panel=' + $('#search-type').val() + urlIndexPiece;
}
});

$('body').on('click', 'a.jumpLink', function (e) {
e.preventDefault();
var target = $(e.target);
kdp.sendNotification("doPlay");
kdp.sendNotification("doSeek", target.data('timestamp') * 60);
});
$('body').on('click', 'a.indexJumpLink', function (e) {
e.preventDefault();
var target = $(e.target);
kdp.sendNotification("doPlay");
kdp.sendNotification("doSeek", target.data('timestamp'));
});






var loaded = false;



$('#translate-link').click(function (e) {
var urlIndexPiece = '';
var re;
e.preventDefault();
if ($('#search-type').val() == 'Index') {
var activeIndexPanel = $('#accordionHolder').accordion('option', 'active');
if (activeIndexPanel !== false) {
urlIndexPiece = '&index=' + activeIndexPanel;
}
}
if ($('#translate-link').attr('data-lang') == $('#translate-link').attr('data-linkto')) {
re = /&translate=(.*)/g;
location.href = location.href.replace(re, '') + '&time=' + Math.floor(kdp.evaluate('{video.player.currentTime}')) + '&panel=' + $('#search-type').val() + urlIndexPiece;
} else {
re = /&time=(.*)/g;
location.href = location.href.replace(re, '') + '&translate=1&time=' + Math.floor(parent.kdp.evaluate('{video.player.currentTime}')) + '&panel=' + $('#search-type').val() + urlIndexPiece;
}
});

$('body').on('click', 'a.jumpLink', function (e) {
e.preventDefault();
var target = $(e.target);
kdp.sendNotification("doPlay");
kdp.sendNotification("doSeek", target.data('timestamp') * 60);
});
$('body').on('click', 'a.indexJumpLink', function (e) {
e.preventDefault();
var target = $(e.target);
kdp.sendNotification("doPlay");
kdp.sendNotification("doSeek", target.data('timestamp'));
$('body').animate({scrollTop : 0},800);
});






});
137 changes: 69 additions & 68 deletions js/viewer_legacy.js
Original file line number Diff line number Diff line change
@@ -1,60 +1,61 @@
jQuery(function ($) {
var loaded = false;
var loaded = false;


$('#translate-link').click(function (e) {
var urlIndexPiece = '';
var re;
e.preventDefault();
if ($('#search-type').val() == 'Index') {
var activeIndexPanel = $('#accordionHolder').accordion('option', 'active');
if (activeIndexPanel !== false) {
urlIndexPiece = '&index=' + activeIndexPanel;
}
}
if ($('#translate-link').attr('data-lang') == $('#translate-link').attr('data-linkto')) {
re = /&translate=(.*)/g;
location.href = location.href.replace(re, '') + '&time=' + Math.floor(jQuery('#subjectPlayer').data("jPlayer").status.currentTime) + '&panel=' + $('#search-type').val() + urlIndexPiece;
} else {
re = /&time=(.*)/g;
location.href = location.href.replace(re, '') + '&translate=1&time=' + Math.floor(jQuery('#subjectPlayer').data("jPlayer").status.currentTime) + '&panel=' + $('#search-type').val() + urlIndexPiece;
}
});

if ($('#subjectPlayer')[0]) {
jQuery.jPlayer.timeFormat.showHour = true;
jQuery("#subjectPlayer").jPlayer({
ready: function () {
playerData = {};
playerData.title = "Player";
playerData[jQuery('#subjectPlayer').attr('rel')] = jQuery('#subjectPlayer').attr('href');
if ('time' in vars) {
jQuery(this).jPlayer("setMedia", playerData).jPlayer("play", vars.time * 1);
$('#translate-link').click(function (e) {
var urlIndexPiece = '';
var re;
e.preventDefault();
if ($('#search-type').val() == 'Index') {
var activeIndexPanel = $('#accordionHolder').accordion('option', 'active');
if (activeIndexPanel !== false) {
urlIndexPiece = '&index=' + activeIndexPanel;
}
}
if ($('#translate-link').attr('data-lang') == $('#translate-link').attr('data-linkto')) {
re = /&translate=(.*)/g;
location.href = location.href.replace(re, '') + '&time=' + Math.floor(jQuery('#subjectPlayer').data("jPlayer").status.currentTime) + '&panel=' + $('#search-type').val() + urlIndexPiece;
} else {
jQuery(this).jPlayer("setMedia", playerData).jPlayer("play");
re = /&time=(.*)/g;
location.href = location.href.replace(re, '') + '&translate=1&time=' + Math.floor(jQuery('#subjectPlayer').data("jPlayer").status.currentTime) + '&panel=' + $('#search-type').val() + urlIndexPiece;
}
},
loadstart: function () {
jQuery('#jp-loading-graphic').show();
},
playing: function () {
jQuery('#jp-loading-graphic').hide();
},
swfPath: "swf",
supplied: jQuery('#subjectPlayer').attr('rel')
});
}

$('body').on('click', 'a.jumpLink', function (e) {
e.preventDefault();
jQuery('#subjectPlayer').jPlayer("play", $(e.target).data('timestamp') * 60);
});
$('body').on('click', 'a.indexJumpLink', function (e) {
e.preventDefault();
jQuery('#subjectPlayer').jPlayer("play", $(e.target).data('timestamp'));
});
if ($('#subjectPlayer')[0]) {
jQuery.jPlayer.timeFormat.showHour = true;
jQuery("#subjectPlayer").jPlayer({
ready: function () {
playerData = {};
playerData.title = "Player";
playerData[jQuery('#subjectPlayer').attr('rel')] = jQuery('#subjectPlayer').attr('href');
if ('time' in vars) {
jQuery(this).jPlayer("setMedia", playerData).jPlayer("play", vars.time * 1);
} else {
jQuery(this).jPlayer("setMedia", playerData).jPlayer("play");
}
},
loadstart: function () {
jQuery('#jp-loading-graphic').show();
},
playing: function () {
jQuery('#jp-loading-graphic').hide();
},
swfPath: "swf",
supplied: jQuery('#subjectPlayer').attr('rel'),
});
}

$('body').on('click', 'a.jumpLink', function (e) {
e.preventDefault();
jQuery('#subjectPlayer').jPlayer("play", $(e.target).data('timestamp') * 60);
});
$('body').on('click', 'a.indexJumpLink', function (e) {
e.preventDefault();
jQuery('#subjectPlayer').jPlayer("play", $(e.target).data('timestamp'));
$('body').animate({scrollTop: 0}, 800);
});



});

//Brightcove code ======================
Expand All @@ -64,38 +65,38 @@ var modExp;
var modCon;

function onTemplateLoaded(experienceID) {
bcExp = brightcove.getExperience(experienceID);
modVP = bcExp.getModule(APIModules.VIDEO_PLAYER);
modExp = bcExp.getModule(APIModules.EXPERIENCE);
modCon = bcExp.getModule(APIModules.CONTENT);
modExp.addEventListener(BCExperienceEvent.TEMPLATE_READY, onTemplateReady);
modExp.addEventListener(BCExperienceEvent.CONTENT_LOAD, onContentLoad);
modCon.addEventListener(BCContentEvent.VIDEO_LOAD, onVideoLoad);
bcExp = brightcove.getExperience(experienceID);
modVP = bcExp.getModule(APIModules.VIDEO_PLAYER);
modExp = bcExp.getModule(APIModules.EXPERIENCE);
modCon = bcExp.getModule(APIModules.CONTENT);
modExp.addEventListener(BCExperienceEvent.TEMPLATE_READY, onTemplateReady);
modExp.addEventListener(BCExperienceEvent.CONTENT_LOAD, onContentLoad);
modCon.addEventListener(BCContentEvent.VIDEO_LOAD, onVideoLoad);
}

function onTemplateReady(evt) {
//Empty
//Empty
}

function onContentLoad(evt) {
var currentVideo = modVP.getCurrentVideo();
modCon.getMediaAsynch(currentVideo.id);
var currentVideo = modVP.getCurrentVideo();
modCon.getMediaAsynch(currentVideo.id);
}

function onVideoLoad(evt) {
if (modVP !== undefined) {
modVP.loadVideo(evt.video.id);
}
if (modVP !== undefined) {
modVP.loadVideo(evt.video.id);
}
}

function goToAudioChunk(key, chunksize) {
if (modVP !== undefined) {
modVP.seek(key * chunksize * 60);
}
if (modVP !== undefined) {
modVP.seek(key * chunksize * 60);
}
}

function goToSecond(key) {
if (modVP !== undefined) {
modVP.seek(key);
}
if (modVP !== undefined) {
modVP.seek(key);
}
}
1 change: 1 addition & 0 deletions js/viewer_other.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ jQuery(function ($) {
$('body').on('click', 'a.indexJumpLink', function (e) {
e.preventDefault();
jQuery('#subjectPlayer').jPlayer("play", $(e.target).data('timestamp'));
$('body').animate({scrollTop: 0}, 800);
});


Expand Down
1 change: 1 addition & 0 deletions js/viewer_soundcloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jQuery(function ($) {
widget.seekTo(curPlayPoint * 1000);
widget.play();
});
$('body').animate({scrollTop : 0},800);
});


Expand Down
1 change: 1 addition & 0 deletions js/viewer_youtube.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jQuery(function ($) {
player.playVideo();
player.seekTo(target.data('timestamp'));
}
$('body').animate({scrollTop : 0},800);
});
function responsiveYoutubePlayer() {
padding = 30;
Expand Down
Loading

0 comments on commit 1cde7b9

Please sign in to comment.