padmatexts:
This commit is contained in:
parent
1833914788
commit
9019a05ab1
|
@ -126,6 +126,18 @@ padmaVideo.prototype.getLayersAtTimecode = function(tc) {
|
|||
return layers;
|
||||
}
|
||||
|
||||
padmaVideo.prototype.getLayerById = function(id) {
|
||||
var that = this;
|
||||
var id = $.trim(id);
|
||||
for (var i=0; i < that.layers.length; i++) {
|
||||
var thisLayer = that.layers[i];
|
||||
if (thisLayer.id == id) {
|
||||
return thisLayer;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function filterLayersByTracks(layers, tracks) {
|
||||
var matchedLayers = []
|
||||
for (var i=0; i < layers.length; i++) {
|
||||
|
|
|
@ -15,17 +15,22 @@
|
|||
$(this).attr("target", "_blank");
|
||||
var link = href;
|
||||
if (link.indexOf(PADMA_URL) != -1) {
|
||||
$(that).addClass('padmaLink');
|
||||
|
||||
var linkData = parsePadmaUrl(link, PADMA_URL);
|
||||
if (linkData) {
|
||||
if (linkData && $.inArray(linkData.type, ['info', 'tcRange', 'editor', 'tc', 'layer'])) {
|
||||
//Don't fetch data twice if video id already exists
|
||||
$(that).addClass('padmaLink');
|
||||
var videoId = linkData.videoId;
|
||||
/*
|
||||
var cacheVideo = padmaVideo.getFromCache(videoId);
|
||||
if (cacheVideo) {
|
||||
var videoObj = cacheVideo;
|
||||
} else {
|
||||
var videoObj = new padmaVideo(videoId);
|
||||
}
|
||||
*/
|
||||
var videoObj = new padmaVideo(videoId);
|
||||
|
||||
|
||||
// console.log(linkData);
|
||||
videoObj.getAllData(setupPadmaLink, {'linkData': linkData, 'jq': that});
|
||||
|
|
37
test.js
37
test.js
|
@ -74,10 +74,39 @@ var $padmaQuery = jQuery.noConflict();
|
|||
sidebarAnimateIn();
|
||||
}
|
||||
padmaContainer.empty();
|
||||
var sidebarWrap = $('<div />').attr("id", "padmaSidebarWrapper").css({'position': 'relative'}).appendTo($container);
|
||||
var videoElem = $('<video />').addClass('padmaVideo').attr("src", videoObj.getLayerVideo(linkData.tcIn, linkData.tcOut)).attr("autoplay", "autoplay").attr("controls", "controls").appendTo(sidebarWrap).css({'width': '400px'});
|
||||
var annotHeight = $(document).height() - parseInt((videoObj.video.height / videoObj.stream_width) * 400) - 20;
|
||||
var annotations = $('<div />').addClass('annotationText').css({'height': annotHeight + "px", "overflow-y": "auto"}).appendTo(sidebarWrap);
|
||||
var sidebarWrap = $('<div />')
|
||||
.attr("id", "padmaSidebarWrapper")
|
||||
.css({'position': 'relative', 'height': '100%'})
|
||||
.appendTo($container);
|
||||
var videoElem = $('<video />')
|
||||
.addClass('padmaVideo')
|
||||
.attr("src", videoObj.getLayerVideo(linkData.tcIn, linkData.tcOut))
|
||||
.attr("autoplay", "autoplay")
|
||||
.attr("controls", "controls")
|
||||
.appendTo(sidebarWrap)
|
||||
.css({'width': '400px'});
|
||||
var annotHeight = $(window).height() - parseInt((videoObj.video.height / videoObj.video.stream_width) * 400) - 20;
|
||||
var annotations = $('<div />')
|
||||
.addClass('annotationText')
|
||||
.css({'height': annotHeight + "px", "overflow-y": "auto"})
|
||||
.appendTo(sidebarWrap);
|
||||
var padmaButtons = $('<div />')
|
||||
.addClass('padmaButtons')
|
||||
.css({'position': 'absolute', 'bottom': '1px', 'right': '8px', 'color': padmaConfig.color, 'font-size': '12px'})
|
||||
.appendTo(sidebarWrap);
|
||||
var padmaUrl = linkData.url;
|
||||
var padmaLayerBtn = $('<a />')
|
||||
.addClass('padmaButton')
|
||||
.text("See on Padma")
|
||||
.attr("target", "_blank")
|
||||
.attr("href", padmaUrl)
|
||||
.css({'text-decoration': 'none', 'color': '#ffff00'})
|
||||
.appendTo(padmaButtons)
|
||||
.hover(function() {
|
||||
$(this).css({'color': padmaConfig.color});
|
||||
}, function() {
|
||||
$(this).css({'color': '#ffff00'});
|
||||
});
|
||||
var html = getLayersHtml(npt2ms(linkData.tcIn), p.default_layers);
|
||||
$('.annotationText').html(html);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user