From c596c19bfdfa08185114218831bf98117a344490 Mon Sep 17 00:00:00 2001 From: dkanada Date: Sat, 23 Nov 2019 01:41:51 +0900 Subject: [PATCH] Merge pull request #583 from Wunax/fix-player-aspect-ratio Fixed set aspect ratio option in the player (cherry picked from commit dca07007707e907ed3d6568e6878a67d28cca4c6) Signed-off-by: Joshua Boniface --- src/components/htmlvideoplayer/plugin.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/components/htmlvideoplayer/plugin.js b/src/components/htmlvideoplayer/plugin.js index ee7087c3cc..f29ddb74c8 100644 --- a/src/components/htmlvideoplayer/plugin.js +++ b/src/components/htmlvideoplayer/plugin.js @@ -1481,6 +1481,7 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa } list.push('SetBrightness'); + list.push("SetAspectRatio") return list; } @@ -1709,7 +1710,15 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa }; HtmlVideoPlayer.prototype.setAspectRatio = function (val) { - + var mediaElement = this._mediaElement; + if (mediaElement) { + if ("auto" === val) { + mediaElement.style.removeProperty("object-fit") + } else { + mediaElement.style["object-fit"] = val + } + } + this._currentAspectRatio = val }; HtmlVideoPlayer.prototype.getAspectRatio = function () { @@ -1717,7 +1726,16 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa }; HtmlVideoPlayer.prototype.getSupportedAspectRatios = function () { - return []; + return [{ + name: "Auto", + id: "auto" + }, { + name: "Cover", + id: "cover" + }, { + name: "Fill", + id: "fill" + }] }; HtmlVideoPlayer.prototype.togglePictureInPicture = function () {