Skip to content

Commit

Permalink
Minor change
Browse files Browse the repository at this point in the history
  • Loading branch information
burhandodhy committed Jul 30, 2024
1 parent c1c706f commit dda14ac
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 50 deletions.
10 changes: 5 additions & 5 deletions assets/js/src/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,18 @@

element.useEffect(() => {
if (!experienceId) {
let newMaxHeight;
let newHeight;
if (aspectRatio === '16:9') {
newMaxHeight = parseInt(parseInt(width, 10) * (9 / 16), 10) + 'px';
newHeight = parseInt(parseInt(width, 10) * (9 / 16), 10) + 'px';
} else if (aspectRatio === '4:3') {
newMaxHeight = parseInt(parseInt(width, 10) * (3 / 4), 10) + 'px';
newHeight = parseInt(parseInt(width, 10) * (3 / 4), 10) + 'px';
} else {
newMaxHeight = height;
newHeight = height;
}

props.setAttributes({
...props.attributes,
height: newMaxHeight,
height: newHeight,
});
}
}, [width, sizing, aspectRatio, height, experienceId]);
Expand Down
49 changes: 4 additions & 45 deletions assets/js/src/views/media-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,30 +167,8 @@ var MediaDetailsView = BrightcoveView.extend({
width = $('#width').val(),
height = $('#height').val(),
units = 'px',
minWidth = '0px',
maxWidth = width + units,
shortcode;

if (aspectRatio === '16:9') {
paddingTop = '56';
} else if (aspectRatio === '4:3') {
paddingTop = '75';
} else {
paddingTop = (height / width) * 100;
}

if (sizing === 'responsive') {
width = '100%';
height = '100%';
} else {
width += units;
height += units;

if (embedStyle === 'iframe') {
minWidth = width;
}
}

shortcode =
'[bc_video video_id="' +
videoId +
Expand All @@ -216,15 +194,14 @@ var MediaDetailsView = BrightcoveView.extend({
languagedetection +
'" application_id="' +
applicationId +
'" max_width="' +
maxWidth +
'" ' +
'mute="' +
mute +
'" width="' +
width +
units +
'" height="' +
height +
units +
'" aspect_ratio="' +
aspectRatio +
'" sizing="' +
Expand All @@ -248,26 +225,11 @@ var MediaDetailsView = BrightcoveView.extend({

var experienceId = $('#video-player').val(),
embedStyle = $('input[name="embed-style"]:checked').val(),
sizing = $('input[name="sizing"]:checked').val(),
width = $('#width').val(),
height = $('#height').val(),
units = 'px',
minWidth = '0px',
maxWidth = width + units,
shortcode;

if (sizing === 'responsive') {
width = '100%';
height = '100%';
} else {
width += units;
height += units;

if (embedStyle === 'iframe') {
minWidth = width;
}
}

shortcode =
'[bc_experience experience_id="' +
experienceId +
Expand All @@ -276,15 +238,12 @@ var MediaDetailsView = BrightcoveView.extend({
'" ' +
'embed="' +
embedStyle +
'" min_width="' +
minWidth +
'" max_width="' +
maxWidth +
'" ' +
'width="' +
width +
units +
'" height="' +
height +
units +
'" ' +
'video_ids="' +
videoIds +
Expand Down

0 comments on commit dda14ac

Please sign in to comment.