single-file-core 1.6.32 → 1.6.34

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.
Files changed (2) hide show
  1. package/core/index.js +7 -2
  2. package/package.json +1 -1
package/core/index.js CHANGED
@@ -1318,11 +1318,16 @@ class Processor {
1318
1318
  const attributeValue = videoElement.getAttribute(util.VIDEO_ATTRIBUTE_NAME);
1319
1319
  if (attributeValue) {
1320
1320
  const videoData = this.options.videos[Number(attributeValue)];
1321
- const src = videoData.src || videoElement.src;
1321
+ const src = videoData && videoData.size && (videoData.src || videoElement.src);
1322
1322
  if (src) {
1323
1323
  const blankPosterURI = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='" +
1324
1324
  (videoData.size.videoWidth || videoData.size.pxWidth) + "' height='" +
1325
1325
  (videoData.size.videoHeight || videoData.size.pxHeight) + "'%3E%3C/svg%3E";
1326
+ const liveDoc = this.options.doc || (this.options.win && this.options.win.document);
1327
+ if (!liveDoc) {
1328
+ videoElement.poster = this.registerGeneratedDataURI(blankPosterURI);
1329
+ return;
1330
+ }
1326
1331
  const temporaryVideoElement = this.doc.createElement("video");
1327
1332
  temporaryVideoElement.src = src;
1328
1333
  temporaryVideoElement.style.setProperty("width", videoData.size.pxWidth + "px", "important");
@@ -1331,7 +1336,7 @@ class Processor {
1331
1336
  temporaryVideoElement.crossOrigin = "anonymous";
1332
1337
  const canvasElement = this.doc.createElement("canvas");
1333
1338
  const context = canvasElement.getContext("2d");
1334
- this.options.doc.body.appendChild(temporaryVideoElement);
1339
+ liveDoc.body.appendChild(temporaryVideoElement);
1335
1340
  return new Promise(resolve => {
1336
1341
  temporaryVideoElement.currentTime = videoData.currentTime;
1337
1342
  temporaryVideoElement.oncanplay = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "single-file-core",
3
- "version": "1.6.32",
3
+ "version": "1.6.34",
4
4
  "description": "SingleFile Core",
5
5
  "author": "Gildas Lormeau",
6
6
  "license": "AGPL-3.0-or-later",