Skip to content

Commit 5ed2eb8

Browse files
committed
player: Ensure video retains consistent sizing
This ensures that cycling between full screen and non-full screen does not cause any change of the positioning of the video nor its size. By removing the video element CSS in main.scss, we can additionally have a fully responsive video element that will be a nominal 600px for the majority of our video content. This can be explored later. Closes: AP-339
1 parent f0d5e05 commit 5ed2eb8

3 files changed

Lines changed: 15 additions & 4 deletions

File tree

app/assets/stylesheets/includes/main.scss

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,10 +326,22 @@ strong {
326326
*/
327327

328328
video {
329-
height: 270px; /* MediaElement.js default height */
329+
height: 270px !important; /* MediaElement.js default height */
330330
width: 100%;
331331
}
332332

333+
.mejs__container {
334+
height: 270px !important;
335+
}
336+
337+
.mejs__container-fullscreen {
338+
height: 100% !important;
339+
}
340+
341+
.mejs__container-fullscreen video {
342+
height: 100% !important;
343+
}
344+
333345
audio {
334346
height: 40px;
335347
width: 100%;

app/views/player/_player_head_additional.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
// (when the HLS stream contains WebVTT captions)
3939
hls: { enableWebVTT: false },
4040
iconSprite: "/assets/icons/mejs-controls.svg",
41+
stretching: 'responsive',
4142
success: function (mediaElement, originalNode, instance) {
4243
if (typeof dashjs !== "undefined") {
4344
// workaround for mediaelement/mediaelement#2964

app/views/player/_video.html.erb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
<%# TODO: figure out how to programmatically set height with JavaScript, or something %>
2-
<%# should match app/assets/stylesheets/application.scss %>
3-
<video id="video-<%= index %>" width="100%" height="270" preload="<%= preload %>" controls crossorigin="anonymous">
1+
<video id="video-<%= index %>" preload="<%= preload %>" controls crossorigin="anonymous">
42
<% if browser.platform.ios? || browser.device.ipad? %>
53
<source src="<%= track.hls_uri %>" type="<%= BerkeleyLibrary::AV::Track::SOURCE_TYPE_HLS %>"/>
64
<%# a separate track tag is not necessary here for captions as Wowza sends them as part of the HLS stream, and iOS will auto discover them %>

0 commit comments

Comments
 (0)