only load embed player if it was not removed already

This commit is contained in:
j 2013-08-10 10:53:59 +00:00
parent 8eec34a3e8
commit 7790d02af7
2 changed files with 19 additions and 3 deletions

View file

@ -45,8 +45,12 @@ pandora.ui.embedPanel = function() {
return that; return that;
}; };
that.reloadPanel = function() { //only add reloadPanel if not defined by embed element
that.setElement(pandora.$ui.embedPanel = pandora.ui.embedPanel()); that.reloadPanel = that.reloadPanel || function(data) {
if (Ox.isUndefined(data) || data.value != data.previousValue) {
pandora.$ui.embedPanel.replaceWith(pandora.$ui.embedPanel = pandora.ui.embedPanel());
return pandora.$ui.ui.embedPanel;
}
return that; return that;
}; };

View file

@ -22,6 +22,7 @@ pandora.ui.embedPlayer = function() {
width: window.innerWidth width: window.innerWidth
}, },
options = getOptions(), options = getOptions(),
removed = false,
video, video,
$innerPanel, $outerPanel, $innerPanel, $outerPanel,
$title, $player, $controls, $timeline, $annotations; $title, $player, $controls, $timeline, $annotations;
@ -30,7 +31,9 @@ pandora.ui.embedPlayer = function() {
'duration', 'durations', 'layers', 'parts', 'posterFrame', 'duration', 'durations', 'layers', 'parts', 'posterFrame',
'rightslevel', 'size', 'title', 'videoRatio' 'rightslevel', 'size', 'title', 'videoRatio'
]}, function(result) { ]}, function(result) {
if (removed) {
return;
}
video = Ox.extend(result.data, pandora.getVideoOptions(result.data)); video = Ox.extend(result.data, pandora.getVideoOptions(result.data));
var isFrame = options['in'] !== void 0 && ( var isFrame = options['in'] !== void 0 && (
@ -320,6 +323,15 @@ pandora.ui.embedPlayer = function() {
options.showAnnotations && $annotations.options({position: position}); options.showAnnotations && $annotations.options({position: position});
} }
that.reloadPanel = function(data) {
if (Ox.isUndefined(data) || data.value != data.previousValue) {
removed = true;
pandora.$ui.embedPanel.replaceWith(pandora.$ui.embedPanel = pandora.ui.embedPanel());
return pandora.$ui.ui.embedPanel;
}
return that;
};
that.resizePanel = function() { that.resizePanel = function() {
var sizes = getSizes(); var sizes = getSizes();
$player.options({width: window.innerWidth, height: sizes.videoHeight}); $player.options({width: window.innerWidth, height: sizes.videoHeight});