@latest-thinking/lt-player 1.0.4-p → 1.0.4-q
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -26,7 +26,8 @@ export class LTPlayerConfig {
|
|
|
26
26
|
share: null,
|
|
27
27
|
chapters : null,
|
|
28
28
|
playerType: null,
|
|
29
|
-
device : 'desktop'
|
|
29
|
+
device : 'desktop',
|
|
30
|
+
observe : false
|
|
30
31
|
}
|
|
31
32
|
processor : LTPlayerConfigProcessor.Map
|
|
32
33
|
|
|
@@ -38,7 +39,6 @@ export class LTPlayerConfig {
|
|
|
38
39
|
this.processor = new LTPlayerConfigProcessor.Map();
|
|
39
40
|
this.setVersion(version);
|
|
40
41
|
this.processor.setVersion(this.configData.version);
|
|
41
|
-
// this.processConfigData();
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
mapConfigData(config : playerConfigType) {
|
|
@@ -70,6 +70,14 @@ export class LTPlayerConfig {
|
|
|
70
70
|
this.configData.version = version;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
getVersion() {
|
|
74
|
+
return this.configData.version
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
getObserve() {
|
|
78
|
+
return this.configData.observe
|
|
79
|
+
}
|
|
80
|
+
|
|
73
81
|
getDimensions() {
|
|
74
82
|
return this.configData.dimensions
|
|
75
83
|
}
|
|
@@ -49,12 +49,62 @@ export namespace LTPlayerConfigProcessor {
|
|
|
49
49
|
} else {
|
|
50
50
|
return value;
|
|
51
51
|
}
|
|
52
|
+
case 'observe':
|
|
53
|
+
return Processor.processObserve(value, this.version);
|
|
52
54
|
}
|
|
53
55
|
}
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
export class Processor {
|
|
57
59
|
|
|
60
|
+
static processObserve(data : defaultType, version : number) {
|
|
61
|
+
|
|
62
|
+
let output : defaultType = {
|
|
63
|
+
width : false,
|
|
64
|
+
height : false
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if(!data) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (version === 1) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (Object.keys(data).length === 0) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const setPropriety = (value : boolean | string | number) : boolean => {
|
|
79
|
+
if (!value) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (typeof value === 'boolean') {
|
|
84
|
+
return value;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (typeof value === 'string') {
|
|
88
|
+
return value === 'true' || value === 'TRUE' || value === '1';
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (typeof value === 'number') {
|
|
92
|
+
return value === 1;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return false;
|
|
96
|
+
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
Object.keys(data).forEach(item => {
|
|
100
|
+
if (output.hasOwnProperty(item)) {
|
|
101
|
+
output[item] = setPropriety(data[item]);
|
|
102
|
+
}
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
return output
|
|
106
|
+
}
|
|
107
|
+
|
|
58
108
|
static processChapters(data : defaultType, version : number) {
|
|
59
109
|
|
|
60
110
|
if(!data) {
|
|
@@ -270,8 +270,25 @@ export class ResizeService {
|
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
272
|
|
|
273
|
-
|
|
274
|
-
|
|
273
|
+
const version = this.playerInstance.playerConfig.getVersion();
|
|
274
|
+
const observeConfig = this.playerInstance.playerConfig.getObserve();
|
|
275
|
+
|
|
276
|
+
if (observeConfig) {
|
|
277
|
+
if (observeConfig.hasOwnProperty('width') && observeConfig.width) {
|
|
278
|
+
setWidth();
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
if (observeConfig.hasOwnProperty('height') && observeConfig.height) {
|
|
282
|
+
setHeight();
|
|
283
|
+
}
|
|
284
|
+
} else {
|
|
285
|
+
setWidth();
|
|
286
|
+
|
|
287
|
+
if (version !== 1) {
|
|
288
|
+
setHeight();
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
275
292
|
setClass();
|
|
276
293
|
}
|
|
277
294
|
}
|