Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
314 changes: 72 additions & 242 deletions backend/servicelists/example.xml

Large diffs are not rendered by default.

72 changes: 58 additions & 14 deletions frontend/android/js/channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Channel.prototype.getMediaPresentationApp = function (serviceInstance) {
if (serviceInstance && serviceInstance.mediaPresentationApps) {
for (i = 0; i < serviceInstance.mediaPresentationApps.length; i++) {
mediaPresentationApp = serviceInstance.mediaPresentationApps[i];
if (mediaPresentationApp.contentType == XML_MIME || mediaPresentationApp.contentType == XHTML_MIMR) {
if (mediaPresentationApp.contentType == XML_MIME || mediaPresentationApp.contentType == XHTML_MIME) {
return mediaPresentationApp.url;
}
}
Expand All @@ -174,6 +174,50 @@ Channel.prototype.checkAvailability = function () {
this.availablityTimer = setTimeout(this.checkAvailability.bind(this), 60 * 1000);
};

function UUIDv7() {
// see https://stackoverflow.com/questions/71816194/uuidv6-v7-v8-in-javascript-browser
return "tttttttt-tttt-7xxx-yxxx-xxxxxxxxxxxx"
.replace(/[xy]/g, function (c) {
const r = Math.trunc(Math.random() * 16);
const v = c == "x" ? r : (r & 0x3) | 0x8;
return v.toString(16);
})
.replace(/^[t]{8}-[t]{4}/, function () {
const unixtimestamp = Date.now().toString(16).padStart(12, "0");
return unixtimestamp.slice(0, 8) + "-" + unixtimestamp.slice(8);
});
}

function DASHjsVersion5(player) {
var [major, minor, micro] = player.getVersion().split(".");
return major >= 5;
}

function playDASH(player, instance) {
if (instance == null) {
player.updateSettings({ streaming: { cmcd: { enabled: false } } });
player.attachSource(null);
return;
}

if (instance.hasOwnProperty("CMCDinit") && instance.CMCDinit != null) {
var cmcd_vars = { ...instance.CMCDinit };
cmcd_vars.sid = UUIDv7();
if (DASHjsVersion5(player)) {
cmcd_vars.applyParametersFromMpd = false;
cmcd_vars.includeInRequests = ["segment", "mpd"];
} else {
delete cmcd_vars.version;
}
player.updateSettings({
streaming: { cmcd: cmcd_vars },
});
} else {
player.updateSettings({ streaming: { cmcd: { enabled: false } } });
}
player.attachSource(instance.dashUrl);
}

Channel.prototype.channelSelected = function () {
var self = this;
$("#notification").hide();
Expand Down Expand Up @@ -205,21 +249,21 @@ Channel.prototype.channelSelected = function () {
} else if (self.isProgramAllowed()) {
$("#parentalpin").hide();
if (self.serviceInstance) {
player.attachSource(self.serviceInstance.dashUrl);
playDASH(player, self.serviceInstance);
}
} else {
player.attachSource(null);
playDASH(player, null);
checkParentalPIN(
"Enter parental PIN to watch service",
function () {
$("#notification").hide();
try {
if (player.getSource() != self.serviceInstance.dashUrl) {
player.attachSource(self.serviceInstance.dashUrl);
playDASH(player, self.serviceInstance);
}
} catch (e) {
//player throws an error is there is no souce attached
player.attachSource(self.serviceInstance.dashUrl);
playDASH(player, self.serviceInstance);
}
},
function () {
Expand Down Expand Up @@ -247,11 +291,11 @@ Channel.prototype.programChanged = function () {
$("#notification").hide();
try {
if (player.getSource() != serviceInstance.dashUrl) {
player.attachSource(serviceInstance.dashUrl);
playDASH(player, serviceInstance);
}
} catch (e) {
//player throws an error is there is no souce attached
player.attachSource(serviceInstance.dashUrl);
playDASH(player, serviceInstance);
}
} else {
player.attachSource(null);
Expand All @@ -261,11 +305,11 @@ Channel.prototype.programChanged = function () {
$("#notification").hide();
try {
if (player.getSource() != serviceInstance.dashUrl) {
player.attachSource(serviceInstance.dashUrl);
playDASH(player, serviceInstance);
}
} catch (e) {
//player throws an error is there is no souce attached
player.attachSource(serviceInstance.dashUrl);
playDASH(player, serviceInstance);
}
},
function () {
Expand Down Expand Up @@ -479,11 +523,11 @@ Channel.prototype.parentalRatingChanged = function (callback) {
$("#notification").hide();
try {
if (player.getSource() != serviceInstance.dashUrl) {
player.attachSource(serviceInstance.dashUrl);
playDASH(player, serviceInstance);
}
} catch (e) {
//player throws an error is there is no souce attached
player.attachSource(serviceInstance.dashUrl);
//player throws an error if there is no souce attached
playDASH(player, serviceInstance);
}
} else {
player.attachSource(null);
Expand All @@ -493,11 +537,11 @@ Channel.prototype.parentalRatingChanged = function (callback) {
$("#notification").hide();
try {
if (player.getSource() != serviceInstance.dashUrl) {
player.attachSource(serviceInstance.dashUrl);
playDASH(player, serviceInstance);
}
} catch (e) {
//player throws an error is there is no souce attached
player.attachSource(serviceInstance.dashUrl);
playDASH(player, serviceInstance);
}
},
function () {
Expand Down
86 changes: 64 additions & 22 deletions frontend/android/js/dvbi-mobile.js
Original file line number Diff line number Diff line change
Expand Up @@ -709,31 +709,73 @@ function showStreamInfo() {
function updateStreamInfo() {
if (player) {
try {
document.getElementById("DASHjs_version").innerHTML = player.getVersion();
var settings = player.getSettings();
document.getElementById("live_settings").innerHTML =
"Low latency mode:" +
settings.streaming.lowLatencyEnabled +
" Delay:" +
settings.streaming.liveDelay +
"<br/>Min drift:" +
settings.streaming.liveCatchUpMinDrift +
" Catchup Rate" +
settings.streaming.liveCatchUpPlaybackRate;
var audioTrack = player.getBitrateInfoListFor("audio")[player.getQualityFor("audio")];
var videoTrack = player.getBitrateInfoListFor("video")[player.getQualityFor("video")];
var bestAudio = player.getTopBitrateInfoFor("audio");
var bestVideo = player.getTopBitrateInfoFor("video");
if (audioTrack) {
document.getElementById("audio_bitrate").innerHTML =
audioTrack.bitrate / 1000 + "kbits (max:" + bestAudio.bitrate / 1000 + "kbits)";
}
if (videoTrack) {
document.getElementById("video_bitrate").innerHTML =
videoTrack.bitrate / 1000 + "kbits (max:" + bestVideo.bitrate / 1000 + "kbits)";

if (DASHjsVersion5(player)) {
document.getElementById("live_settings").innerHTML =
"Low latency mode:" +
player.getLowLatencyModeEnabled() +
" Delay:" +
"INDEVv5" +
"<br/>Min drift:" +
"INDEVv5" +
" Catchup Rate:" +
"INDEVv5";

var audioTrack = player.getCurrentRepresentationForType("audio");
var highestAudio = 0,
audioReps = player.getRepresentationsByType("audio");
for (var i = 0; i < audioReps.length; i++) {
if (audioReps[i].bitrateInKbit > highestAudio) highestAudio = audioReps[i].bitrateInKbit;
}
document.getElementById("audio_bitrate").innerHTML = audioTrack
? audioTrack.bitrateInKbit + "kbits (max:" + highestAudio + "kbits)"
: "no-audio";

var videoTrack = player.getCurrentRepresentationForType("video");
var highestVideo = 0,
highestRes = null,
videoReps = player.getRepresentationsByType("video");
for (var j = 0; j < videoReps.length; j++) {
if (videoReps[j].bitrateInKbit > highestVideo) {
highestVideo = videoReps[j].bitrateInKbit;
highestRes = videoReps[j].width + "x" + videoReps[j].height;
}
}
document.getElementById("video_bitrate").innerHTML = videoTrack
? videoTrack.bitrateInKbit + "kbits (max:" + highestVideo + "kbits)"
: "no-video";
document.getElementById("video_resolution").innerHTML =
videoTrack.width + "x" + videoTrack.height + " (max:" + bestVideo.width + "x" + bestVideo.height + ")";
videoTrack.width + "x" + videoTrack.height + (highestRes ? " (max:" + highestRes + ")" : "");

document.getElementById("live_latency").innerHTML = player.getCurrentLiveLatency() + "s";
} else {
document.getElementById("live_settings").innerHTML =
"Low latency mode:" +
settings.streaming.lowLatencyEnabled +
" Delay:" +
settings.streaming.liveDelay +
"<br/>Min drift:" +
settings.streaming.liveCatchUpMinDrift +
" Catchup Rate:" +
settings.streaming.liveCatchUpPlaybackRate;
var audioTrack = player.getBitrateInfoListFor("audio")[player.getQualityFor("audio")];
var videoTrack = player.getBitrateInfoListFor("video")[player.getQualityFor("video")];
var bestAudio = player.getTopBitrateInfoFor("audio");
var bestVideo = player.getTopBitrateInfoFor("video");
if (audioTrack) {
document.getElementById("audio_bitrate").innerHTML =
audioTrack.bitrate / 1000 + "kbits (max:" + bestAudio.bitrate / 1000 + "kbits)";
}
if (videoTrack) {
document.getElementById("video_bitrate").innerHTML =
videoTrack.bitrate / 1000 + "kbits (max:" + bestVideo.bitrate / 1000 + "kbits)";
document.getElementById("video_resolution").innerHTML =
videoTrack.width + "x" + videoTrack.height + " (max:" + bestVideo.width + "x" + bestVideo.height + ")";
}
document.getElementById("live_latency").innerHTML = player.getCurrentLiveLatency() + "s";
}
document.getElementById("live_latency").innerHTML = player.getCurrentLiveLatency() + "s";
} catch (e) {
document.getElementById("audio_bitrate").innerHTML = "error";
document.getElementById("video_bitrate").innerHTML = "error";
Expand Down
Loading