@luceosports/play-rendering 2.2.2 → 2.2.3
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/dist/play-rendering.js +1 -1
- package/dist/play-rendering.js.map +1 -1
- package/package.json +1 -1
- package/src/helpers/common.ts +7 -11
- package/src/models/PlayModel.ts +10 -1
package/package.json
CHANGED
package/src/helpers/common.ts
CHANGED
|
@@ -29,16 +29,12 @@ export function shapeModelKeyFromImport(shapeModels: typeof ShapeModels, type: S
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export async function loadImage(src: string | Buffer) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
img.src = 'data:image/jpeg;base64,' + src.toString('base64');
|
|
38
|
-
}
|
|
39
|
-
await img.decode();
|
|
40
|
-
return img;
|
|
41
|
-
} catch (e) {
|
|
42
|
-
return null;
|
|
32
|
+
const img = new Image();
|
|
33
|
+
if (typeof src === 'string') {
|
|
34
|
+
img.src = src;
|
|
35
|
+
} else {
|
|
36
|
+
img.src = 'data:image/jpeg;base64,' + src.toString('base64');
|
|
43
37
|
}
|
|
38
|
+
await img.decode();
|
|
39
|
+
return img;
|
|
44
40
|
}
|
package/src/models/PlayModel.ts
CHANGED
|
@@ -123,7 +123,16 @@ export default class PlayModel {
|
|
|
123
123
|
};
|
|
124
124
|
|
|
125
125
|
const luceoSportsWatermark = await loadImage(`${STORAGE_URL}/${LUCEOSPORTS_WATERMARK_PATH}`);
|
|
126
|
-
|
|
126
|
+
|
|
127
|
+
let teamLogoWatermark = null;
|
|
128
|
+
if (teamLogoPath) {
|
|
129
|
+
try {
|
|
130
|
+
teamLogoWatermark = await loadImage(`${STORAGE_URL}/${teamLogoPath}`);
|
|
131
|
+
} catch (e) {
|
|
132
|
+
console.log('teamLogoWatermark loadImage error', e);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
127
136
|
PlayModel.watermark = {
|
|
128
137
|
LuceoSports: luceoSportsWatermark,
|
|
129
138
|
TeamLogo: teamLogoWatermark
|