Skip to content
Permalink
Browse files

[IMP]website, web_editor: improvement in video options

  • Loading branch information...
var-odoo committed Mar 26, 2019
1 parent f3c8d12 commit 49c5befaf22f1a8d0fdee3bdc4186b8457d26acf
@@ -279,7 +279,7 @@
<div class="o_dm_option">
<label class="o_switch mb0"><input id="o_video_hide_dm_share" type="checkbox"/><span/>Hide sharing button</label>
</div>
<div class="row o_yt_option">
<div class="row o_yt_option o_dm_option o_vim_option">
<label class="col-md-4 pre_label">Video background</label>
<label class="col-md-7">
<select name="background" id="o_video_background" class="form-control background">
@@ -289,20 +289,20 @@
</select>
</label>
</div>
<div class="o_yt_option" style="overflow:hidden">
<div class="o_yt_option o_dm_option o_vim_option" style="overflow:hidden">
<label class="col-md-4 pre_label col-form-label" style="padding-left:0px">Opacity</label>
<label class="col-md-7">
<input name="opacity" id="o_video_opacity" type="range" step="0.1" min="0" max="1" value="1" placeholder="1"/>
</label>
</div>
<div class="o_yt_option">
<div class="o_yt_option custom-control custom-radio col-md-6">
<div class="o_yt_option o_dm_option o_vim_option">
<div class="o_yt_option o_dm_option o_vim_option custom-control custom-radio col-md-6">
<input type="radio" id="fitCont" name="iframefit" class="custom-control-input" value="fitCont" checked="checked"/>
<label for="fitCont" class="custom-control-label">
<small>Fill container with video</small>
</label>
</div>
<div class="o_yt_option custom-control custom-radio col-md-6">
<div class="o_yt_option o_dm_option o_vim_option custom-control custom-radio col-md-6">
<input type="radio" id="fitIframe" name="iframefit" class="custom-control-input" value="fitIframe"/>
<label for="fitIframe" class="custom-control-label">
<small>Put video in container</small>
@@ -580,9 +580,10 @@ registry.backgroundVideo = Animation.extend({

whenPlayerReady.then(function ($player) {
$player.fadeTo(0, 0);
$player.addClass('o_player').parent().addClass('o_player_wrapper');
$player.addClass('o_player');
self.ratio = ($player.width() / $player.height());
if (self.$target.attr('iframefit') === 'fitCont') {

$player.parentsUntil(self.$target).css({width: '100%', height: 'auto'});
if ($player.is('iframe')) {
$player.css('width', '100%');
@@ -591,8 +592,9 @@ registry.backgroundVideo = Animation.extend({
$player.css({width: '100%', height: 'auto'});
}
} else if (self.$target.attr('iframefit') === 'fitIframe') {
$player.addClass('oe_create_video_iframe');
$player.parentsUntil(self.$target).addBack().css({width: '100%', height: '100%'});
}
$player.parentsUntil(self.$target).andSelf().css({width: '100%', height: '100%'});

$player.fadeTo("slow", 1);
$player.removeClass('o_media_loading');
@@ -611,11 +613,15 @@ registry.backgroundVideo = Animation.extend({
},
create_video: function ($container, video_url, params) {
return new Promise(function (resolve, reject) {

var $iframe;
if (video_url) {
$($container.children()[0]).removeClass("oe_video_bg");
if($container.find('iframe').length >=1){
$container.find('iframe').remove();
}
$iframe = $('<iframe/>', {
frameborder: "0",
class: "playerBox",
allowfullscreen: "allowfullscreen",
src: video_url,
});
@@ -626,13 +632,13 @@ registry.backgroundVideo = Animation.extend({
if ($iframe.length) {
$container.css('max-height', '');
} else {
Promise.reject();
reject();
}
}

$iframe.addClass('o_media_loading');
$iframe.addClass('o_player');
$iframe.on('load', function () {
Promise.resolve($iframe);
resolve($iframe);
});
$container.append($iframe);
});
@@ -260,6 +260,14 @@ font[class*='bg-'] {
.oe_video_bg {
z-index : -1;
}
.oe_create_video_iframe{
position: absolute;
top: 0;
right: 0;
left: 0;
bottom: 0;
z-index: -1;
}
.oe_video {
position : relative;
overflow : hidden;

0 comments on commit 49c5bef

Please sign in to comment.
You can’t perform that action at this time.