Skip to content

Commit

Permalink
Show warning in case location.protocol is http when accessing the ref…
Browse files Browse the repository at this point in the history
…erence client
  • Loading branch information
dsilhavy committed Nov 16, 2021
1 parent e0eecfe commit c787a25
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions samples/dash-if-reference-player/app/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -660,4 +660,8 @@ BS Information

.bs-callout-information {
border-left-color: #136bfb ;
}

.bs-callout-danger {
border-left-color: #CA0B00;
}
13 changes: 13 additions & 0 deletions samples/dash-if-reference-player/app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1569,6 +1569,8 @@ app.controller('DashController', ['$scope', '$window', 'sources', 'contributors'
return vars;
}

checkLocationProtocol();

var vars = getUrlVars();
var item = {};

Expand Down Expand Up @@ -1698,6 +1700,17 @@ app.controller('DashController', ['$scope', '$window', 'sources', 'contributors'
);
}
}

function checkLocationProtocol() {
if (location.protocol === 'http:' && location.hostname !== 'localhost') {
var out = 'This page has been loaded under http. This can result in the EME APIs not being available to the player and <b>any DRM-protected content will fail to play</b>. ' +
'If you wish to test manifest URLs that require EME support, then <a href=\'https:' + window.location.href.substring(window.location.protocol.length) + '\'>reload this page under https</a>.'
var divContainer = document.getElementById('http-warning-container');
var spanText = document.getElementById('http-warning-text');
spanText.innerHTML = out;
divContainer.style.display = ''
}
}
}]);

function legendLabelClickHandler(obj) { /* jshint ignore:line */
Expand Down
3 changes: 3 additions & 0 deletions samples/dash-if-reference-player/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,9 @@

<!-- STATS TAB CONTENT -->
<div class="col-md-3 tabs-section">
<div class="bs-callout bs-callout-danger" id="http-warning-container" style="display: none;">
<span id="http-warning-text"></span>
</div>
<div class="bs-callout bs-callout-information" id="callout-dropdown-positioning">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
Additional samples can be found in the <a
Expand Down

0 comments on commit c787a25

Please sign in to comment.