Report data to the UI
This commit is contained in:
parent
6eed271814
commit
758c2bf0bc
@ -232,6 +232,7 @@ class PlayerData {
|
|||||||
// NOTE: it's possible that notificationService hasn't been initialized yet at this point.
|
// NOTE: it's possible that notificationService hasn't been initialized yet at this point.
|
||||||
// no biggie if it wasn't, we just won't replace the notification UI
|
// no biggie if it wasn't, we just won't replace the notification UI
|
||||||
this.notificationService?.replace(this.element);
|
this.notificationService?.replace(this.element);
|
||||||
|
this.ui?.updateDebugInfo('player', {dimensions: this.dimensions, elementId: element.id, elementClasses: element.classList});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,8 +301,20 @@ class Resizer {
|
|||||||
this.logger.log('error', 'debug', '[Resizer::setAr] Okay wtf happened? If you see this, something has gone wrong', stretchFactors,"\n------[ i n f o d u m p ]------\nstretcher:", this.stretcher);
|
this.logger.log('error', 'debug', '[Resizer::setAr] Okay wtf happened? If you see this, something has gone wrong', stretchFactors,"\n------[ i n f o d u m p ]------\nstretcher:", this.stretcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const debugObject = {
|
||||||
|
stretch: {
|
||||||
|
x: stretchFactors.xFactor,
|
||||||
|
y: stretchFactors.yFactor
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
this.zoom.applyZoom(stretchFactors);
|
this.zoom.applyZoom(stretchFactors);
|
||||||
|
|
||||||
|
debugObject['stretchAfterZoom'] = {
|
||||||
|
x: stretchFactors.xFactor,
|
||||||
|
y: stretchFactors.yFactor
|
||||||
|
}
|
||||||
|
|
||||||
var translate = this.computeOffsets(stretchFactors);
|
var translate = this.computeOffsets(stretchFactors);
|
||||||
this.applyCss(stretchFactors, translate);
|
this.applyCss(stretchFactors, translate);
|
||||||
}
|
}
|
||||||
@ -514,8 +526,24 @@ class Resizer {
|
|||||||
computeOffsets(stretchFactors){
|
computeOffsets(stretchFactors){
|
||||||
this.logger.log('info', 'debug', "[Resizer::computeOffsets] <rid:"+this.resizerId+"> video will be aligned to ", this.settings.active.sites['@global'].videoAlignment);
|
this.logger.log('info', 'debug', "[Resizer::computeOffsets] <rid:"+this.resizerId+"> video will be aligned to ", this.settings.active.sites['@global'].videoAlignment);
|
||||||
|
|
||||||
|
const debugObject = {};
|
||||||
|
|
||||||
const {realVideoWidth, realVideoHeight, marginX, marginY} = this.computeVideoDisplayedDimensions();
|
const {realVideoWidth, realVideoHeight, marginX, marginY} = this.computeVideoDisplayedDimensions();
|
||||||
|
|
||||||
|
debugObject['videoRawData'] = {
|
||||||
|
streamDimensions: {
|
||||||
|
x: this.conf.video.videoWidth,
|
||||||
|
y: this.conf.video.videoHeight
|
||||||
|
},
|
||||||
|
displayedSize: {
|
||||||
|
x: realVideoWidth,
|
||||||
|
y: realVideoHeight
|
||||||
|
},
|
||||||
|
videoElementSize: {
|
||||||
|
x: this.conf.video.offsetWidth,
|
||||||
|
y: this.conf.video.offsetHeight
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const wdiff = this.conf.player.dimensions.width - realVideoWidth;
|
const wdiff = this.conf.player.dimensions.width - realVideoWidth;
|
||||||
const hdiff = this.conf.player.dimensions.height - realVideoHeight;
|
const hdiff = this.conf.player.dimensions.height - realVideoHeight;
|
||||||
@ -527,14 +555,22 @@ class Resizer {
|
|||||||
const wdiffAfterZoom = realVideoWidth * stretchFactors.xFactor - this.conf.player.dimensions.width;
|
const wdiffAfterZoom = realVideoWidth * stretchFactors.xFactor - this.conf.player.dimensions.width;
|
||||||
const hdiffAfterZoom = realVideoHeight * stretchFactors.yFactor - this.conf.player.dimensions.height;
|
const hdiffAfterZoom = realVideoHeight * stretchFactors.yFactor - this.conf.player.dimensions.height;
|
||||||
|
|
||||||
|
debugObject['sizeDifferenceToPlayer'] = {
|
||||||
|
beforeZoom: {
|
||||||
|
wdiff,
|
||||||
|
hdiff
|
||||||
|
},
|
||||||
|
afterZoom: {
|
||||||
|
wdiff: wdiffAfterZoom,
|
||||||
|
hdiff: hdiffAfterZoom,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const translate = {
|
const translate = {
|
||||||
x: wdiff * 0.5,
|
x: wdiff * 0.5,
|
||||||
y: hdiff * 0.5,
|
y: hdiff * 0.5,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (this.pan) {
|
if (this.pan) {
|
||||||
// don't offset when video is smaller than player
|
// don't offset when video is smaller than player
|
||||||
if(wdiffAfterZoom >= 0 || hdiffAfterZoom >= 0) {
|
if(wdiffAfterZoom >= 0 || hdiffAfterZoom >= 0) {
|
||||||
@ -549,6 +585,15 @@ class Resizer {
|
|||||||
translate.x -= wdiffAfterZoom * 0.5;
|
translate.x -= wdiffAfterZoom * 0.5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
debugObject['videoTranslation'] = {
|
||||||
|
alignment: VideoAlignment.toString(this.videoAlignment),
|
||||||
|
panningEnabled: !!this.pan,
|
||||||
|
x: translate.x,
|
||||||
|
y: translate.y,
|
||||||
|
}
|
||||||
|
|
||||||
|
this.conf.player.ui?.updateDebugInfo('resizer', debugObject);
|
||||||
|
|
||||||
this.logger.log('info', ['debug', 'resizer'], "[Resizer::_res_computeOffsets] <rid:"+this.resizerId+"> calculated offsets:\n\n",
|
this.logger.log('info', ['debug', 'resizer'], "[Resizer::_res_computeOffsets] <rid:"+this.resizerId+"> calculated offsets:\n\n",
|
||||||
'---- data in ----',
|
'---- data in ----',
|
||||||
|
Loading…
Reference in New Issue
Block a user