Skip to content

Commit

Permalink
Add support for legacyUI
Browse files Browse the repository at this point in the history
  • Loading branch information
SangwonOh committed May 2, 2024
1 parent 7160dec commit 38ba861
Show file tree
Hide file tree
Showing 7 changed files with 158 additions and 149 deletions.
2 changes: 1 addition & 1 deletion dist/ovenplayer.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ovenplayer.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ovenplayer",
"version": "0.10.35",
"version": "0.10.36",
"description": "OvenPlayer is Open-Source HTML5 Player. OvenPlayer supports WebRTC Signaling from OvenMediaEngine for Sub-Second Latency Streaming.",
"main": "dist/ovenplayer.js",
"scripts": {
Expand Down
85 changes: 43 additions & 42 deletions src/js/api/Configurator.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,36 @@ import {
* @param options
*
* */
const Configurator = function(options, provider){
const Configurator = function (options, provider) {

const composeSourceOptions = function(options){
const composeSourceOptions = function (options) {
const Defaults = {
mediaContainer : "",
mediaContainer: "",
playbackRates: [2, 1.5, 1, 0.5, 0.25],
playbackRate: 1,
mute: false,
volume: 100,
loop : false,
controls : true,
autoStart : false,
loop: false,
controls: true,
autoStart: false,
autoFallback: true,
timecode : true,
sourceIndex : -1,
browser : "",
hidePlaylistIcon : false,
rtmpBufferTime : 1,
rtmpBufferTimeMax : 3,
adClient : "googleima",
currentProtocolOnly : false,
systemText : null,
lang : "en",
timecode: true,
sourceIndex: -1,
browser: "",
hidePlaylistIcon: false,
rtmpBufferTime: 1,
rtmpBufferTimeMax: 3,
adClient: "googleima",
currentProtocolOnly: false,
systemText: null,
lang: "en",
loadingRetryCount: 0,
expandFullScreenUI: true,
fullscreenOption: null,
showBigPlayButton: true,
doubleTapToSeek: false,
showZoomSettings: false,
legacyUI: false,
};
const serialize = function (val) {
if (val === undefined) {
Expand Down Expand Up @@ -69,25 +70,25 @@ const Configurator = function(options, provider){
deserialize(options);
let config = Object.assign({}, Defaults, options);
let userCustumSystemText = [];
if(config.systemText){
if (config.systemText) {
userCustumSystemText = _.isArray(config.systemText) ? config.systemText : [config.systemText];
}

for(let i = 0; i < userCustumSystemText.length; i ++){
if(userCustumSystemText[i].lang){
let currentSystemText = _.findWhere(SYSTEM_TEXT , {"lang": userCustumSystemText[i].lang});
if(currentSystemText){
for (let i = 0; i < userCustumSystemText.length; i++) {
if (userCustumSystemText[i].lang) {
let currentSystemText = _.findWhere(SYSTEM_TEXT, { "lang": userCustumSystemText[i].lang });
if (currentSystemText) {
//validate & update
Object.assign(currentSystemText, userCustumSystemText[i]);
}else{
} else {
//create
currentSystemText = _.findWhere(SYSTEM_TEXT , {"lang": "en"});
currentSystemText = _.findWhere(SYSTEM_TEXT, { "lang": "en" });
currentSystemText.lang = userCustumSystemText[i].lang;
SYSTEM_TEXT.push(Object.assign(userCustumSystemText[i], currentSystemText));
}
}
}
config.systemText = _.findWhere(SYSTEM_TEXT , {"lang": config.lang});
config.systemText = _.findWhere(SYSTEM_TEXT, { "lang": config.lang });

let playbackRates = config.playbackRates;

Expand Down Expand Up @@ -124,7 +125,7 @@ const Configurator = function(options, provider){
'adTagUrl'
]);

config.playlist = [ obj ];
config.playlist = [obj];
} else if (_.isArray(configPlaylist.playlist)) {
config.feedData = configPlaylist;
config.playlist = configPlaylist.playlist;
Expand Down Expand Up @@ -159,17 +160,17 @@ const Configurator = function(options, provider){
return spec.isFullscreen = isFullscreen;
}*/

that.getPlaybackRate =()=>{
that.getPlaybackRate = () => {
return spec.playbackRate;
};
that.setPlaybackRate =(playbackRate)=>{
that.setPlaybackRate = (playbackRate) => {
spec.playbackRate = playbackRate;
return playbackRate;
};
that.getZoomFactor =()=>{
that.getZoomFactor = () => {
return spec.zoomFactor;
};
that.setZoomFactor =(zoomFactor)=>{
that.setZoomFactor = (zoomFactor) => {
spec.zoomFactor = zoomFactor;
return zoomFactor;
};
Expand Down Expand Up @@ -197,7 +198,7 @@ const Configurator = function(options, provider){
spec.sourceIndex = index;
};
that.setTimecodeMode = (timecode) => {
if(spec.timecode !== timecode){
if (spec.timecode !== timecode) {
spec.timecode = timecode;
provider.trigger(CONTENT_TIME_MODE_CHANGED, timecode);
}
Expand All @@ -211,29 +212,29 @@ const Configurator = function(options, provider){
that.getRtmpBufferTimeMax = () => {
return spec.rtmpBufferTimeMax;
};
that.setMute = (mute) =>{
that.setMute = (mute) => {
spec.mute = mute;
};
that.isMute = () =>{
that.isMute = () => {
return spec.mute;
};
that.getVolume = () =>{
that.getVolume = () => {
return spec.volume;
};
that.setVolume = (volume) =>{
that.setVolume = (volume) => {
spec.volume = volume;
};
that.isLoop = () =>{
that.isLoop = () => {
return spec.loop;
};
that.isAutoStart = () =>{
that.isAutoStart = () => {
return spec.autoStart;
};
that.isControls = () =>{
that.isControls = () => {
return spec.controls;
};

that.getPlaybackRates =()=>{
that.getPlaybackRates = () => {
return spec.playbackRates;
};
that.getBrowser = () => {
Expand All @@ -246,13 +247,13 @@ const Configurator = function(options, provider){
return spec.lang;
};

that.getPlaylist =()=>{
that.getPlaylist = () => {
return spec.playlist;
};
that.setPlaylist =(playlist)=>{
if(_.isArray(playlist)){
that.setPlaylist = (playlist) => {
if (_.isArray(playlist)) {
spec.playlist = playlist;
}else{
} else {
spec.playlist = [playlist];
}
return spec.playlist;
Expand Down
18 changes: 12 additions & 6 deletions src/js/view/components/controls/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ const Controls = function ($container, api) {
hasPlaylist = false;
}

if (api.getConfig().legacyUI === true) {
hasPlaylist = true;
}

let playlistPanel = "";

const onRendered = function ($current, template) {
Expand Down Expand Up @@ -149,9 +153,9 @@ const Controls = function ($container, api) {

function resetControlUI() {

if (timeDisplay) {
timeDisplay.destroy();
}
// if (timeDisplay) {
// timeDisplay.destroy();
// }

if (progressBar) {
progressBar.destroy();
Expand All @@ -161,6 +165,8 @@ const Controls = function ($container, api) {
initFullscreenButton();

$root.removeClass("linear-ad");

initProgressBar(false);
}

playButton = PlayButton($current.find(".op-left-controls"), api);
Expand Down Expand Up @@ -248,9 +254,9 @@ const Controls = function ($container, api) {
$root.addClass("linear-ad");

initProgressBar(true);
if (timeDisplay) {
timeDisplay.destroy();
}
// if (timeDisplay) {
// timeDisplay.destroy();
// }
if (settingButton) {
settingButton.destroy();
}
Expand Down
Loading

0 comments on commit 38ba861

Please sign in to comment.