@swf2es/web 0.1.27 → 0.1.29
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/README.md +9 -0
- package/dist/attributes.d.ts +22 -0
- package/dist/attributes.d.ts.map +1 -1
- package/dist/attributes.js +39 -0
- package/dist/attributes.js.map +1 -1
- package/dist/config.d.ts +17 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/element.d.ts +49 -1
- package/dist/element.d.ts.map +1 -1
- package/dist/element.js +243 -14
- package/dist/element.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/meter.d.ts +68 -0
- package/dist/meter.d.ts.map +1 -0
- package/dist/meter.js +408 -0
- package/dist/meter.js.map +1 -0
- package/dist/playback.d.ts +37 -0
- package/dist/playback.d.ts.map +1 -1
- package/dist/playback.js +43 -1
- package/dist/playback.js.map +1 -1
- package/package.json +5 -5
- package/src/attributes.ts +60 -0
- package/src/config.ts +17 -0
- package/src/element.ts +303 -10
- package/src/index.ts +3 -1
- package/src/meter.ts +484 -0
- package/src/playback.ts +80 -1
package/README.md
CHANGED
|
@@ -42,6 +42,15 @@ element shows a "Click to unmute" button over the SWF and fires
|
|
|
42
42
|
`audioblocked`, then `audiounblocked` once the sound plays;
|
|
43
43
|
`unmuteprompt="false"` leaves the button to the page.
|
|
44
44
|
|
|
45
|
+
A SWF's relative URLs resolve as Flash Player's plug-in resolved them:
|
|
46
|
+
against the page, or against the element's `base`, where `base="."` is
|
|
47
|
+
the SWF's directory and any other value is relative to the page. A page
|
|
48
|
+
that plays SWFs from elsewhere sets `relativeurls="movie"` on the
|
|
49
|
+
element, or `configure({ relativeUrls: "movie" })` for all of them, to
|
|
50
|
+
resolve them against each SWF's own URL. Like `base`, the attribute is
|
|
51
|
+
read when a movie loads; `replaceFlash` carries `base` from a Flash tag
|
|
52
|
+
but not `relativeurls`, which only `configure` sets for those players.
|
|
53
|
+
|
|
45
54
|
The [guide](https://swf2es.github.io/swf2es/docs/) covers the element's
|
|
46
55
|
attributes and options, workers, sockets, files, ExternalInterface and
|
|
47
56
|
precompiled modules.
|
package/dist/attributes.d.ts
CHANGED
|
@@ -12,4 +12,26 @@ export declare function parseFlashVars(value: string | null): Record<string, str
|
|
|
12
12
|
export declare function scriptAccess(value: string | null, swfUrl: string, pageUrl: string): boolean;
|
|
13
13
|
/** Flash's quality names; the auto ones as what they start at. */
|
|
14
14
|
export declare function quality(value: string | null): string;
|
|
15
|
+
/**
|
|
16
|
+
* What the SWFs' relative URLs resolve against without a `base`: "page",
|
|
17
|
+
* the page's URL, as Flash Player's plug-in had them, for a page that
|
|
18
|
+
* embeds its own SWFs; or "movie", each SWF's own (AVM1's the main SWF's),
|
|
19
|
+
* as its projector had them, for a player that re-hosts SWFs from
|
|
20
|
+
* elsewhere. The element's `relativeurls` attribute, else the page's
|
|
21
|
+
* configure({ relativeUrls }), else "page".
|
|
22
|
+
*/
|
|
23
|
+
export type RelativeUrls = "page" | "movie";
|
|
24
|
+
/** `value`, the attribute's, as a choice; `fallback` for none or another word. */
|
|
25
|
+
export declare function relativeUrls(value: string | null, fallback: RelativeUrls | undefined): RelativeUrls;
|
|
26
|
+
/** Whether `url` has a path a relative URL can go under (http:, file:, app:), not blob:, data: or about:. */
|
|
27
|
+
export declare function hierarchical(url: string): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Where every SWF's relative URLs resolve, AS3's and AVM1's, the children's
|
|
30
|
+
* and getURL's too, as Flash's plug-in resolved them from the page's
|
|
31
|
+
* `base` (PepperFlash 32): "." is the SWF's directory, any other value is
|
|
32
|
+
* against the page's URL; without one, or one no URL with a path comes of,
|
|
33
|
+
* the page's URL for "page", and null for "movie" or a page with no path
|
|
34
|
+
* (blob:, data:): each SWF its own.
|
|
35
|
+
*/
|
|
36
|
+
export declare function relativeBase(base: string | null, swfUrl: string | null, pageUrl: string, choice: RelativeUrls): string | null;
|
|
15
37
|
//# sourceMappingURL=attributes.d.ts.map
|
package/dist/attributes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../src/attributes.ts"],"names":[],"mappings":"AAGA,8FAA8F;AAC9F,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAM7D;AAED,kGAAkG;AAClG,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAG9D;AAED,oEAAoE;AACpE,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAO3E;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAe3F;AAED,kEAAkE;AAClE,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAOpD"}
|
|
1
|
+
{"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../src/attributes.ts"],"names":[],"mappings":"AAGA,8FAA8F;AAC9F,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAM7D;AAED,kGAAkG;AAClG,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAG9D;AAED,oEAAoE;AACpE,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAO3E;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAe3F;AAED,kEAAkE;AAClE,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAOpD;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,CAAC;AAE5C,kFAAkF;AAClF,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,GAAG,IAAI,EACpB,QAAQ,EAAE,YAAY,GAAG,SAAS,GACjC,YAAY,CASd;AAED,6GAA6G;AAC7G,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEjD;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,GAAG,IAAI,EACnB,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,YAAY,GACnB,MAAM,GAAG,IAAI,CAef"}
|
package/dist/attributes.js
CHANGED
|
@@ -50,4 +50,43 @@ export function quality(value) {
|
|
|
50
50
|
}
|
|
51
51
|
return ["LOW", "MEDIUM", "HIGH", "BEST"].includes(named) ? named : "HIGH";
|
|
52
52
|
}
|
|
53
|
+
/** `value`, the attribute's, as a choice; `fallback` for none or another word. */
|
|
54
|
+
export function relativeUrls(value, fallback) {
|
|
55
|
+
switch (value?.trim().toLowerCase()) {
|
|
56
|
+
case "page":
|
|
57
|
+
return "page";
|
|
58
|
+
case "movie":
|
|
59
|
+
return "movie";
|
|
60
|
+
default:
|
|
61
|
+
return fallback ?? "page";
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/** Whether `url` has a path a relative URL can go under (http:, file:, app:), not blob:, data: or about:. */
|
|
65
|
+
export function hierarchical(url) {
|
|
66
|
+
return /^[a-z][a-z0-9+.-]*:\//i.test(url);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Where every SWF's relative URLs resolve, AS3's and AVM1's, the children's
|
|
70
|
+
* and getURL's too, as Flash's plug-in resolved them from the page's
|
|
71
|
+
* `base` (PepperFlash 32): "." is the SWF's directory, any other value is
|
|
72
|
+
* against the page's URL; without one, or one no URL with a path comes of,
|
|
73
|
+
* the page's URL for "page", and null for "movie" or a page with no path
|
|
74
|
+
* (blob:, data:): each SWF its own.
|
|
75
|
+
*/
|
|
76
|
+
export function relativeBase(base, swfUrl, pageUrl, choice) {
|
|
77
|
+
const given = base?.trim() ?? "";
|
|
78
|
+
if (given !== "") {
|
|
79
|
+
try {
|
|
80
|
+
const against = given === "." && swfUrl !== null && hierarchical(swfUrl) ? swfUrl : pageUrl;
|
|
81
|
+
const url = new URL(given, against).href;
|
|
82
|
+
if (hierarchical(url)) {
|
|
83
|
+
return url;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
// Against a page with no path: as though there were none.
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return choice === "page" && hierarchical(pageUrl) ? pageUrl : null;
|
|
91
|
+
}
|
|
53
92
|
//# sourceMappingURL=attributes.js.map
|
package/dist/attributes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attributes.js","sourceRoot":"","sources":["../src/attributes.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,4CAA4C;AAE5C,8FAA8F;AAC9F,MAAM,UAAU,SAAS,CAAC,KAAoB;IAC5C,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QAC1C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;AACjF,CAAC;AAED,kGAAkG;AAClG,MAAM,UAAU,UAAU,CAAC,KAAoB;IAC7C,MAAM,GAAG,GAAG,0BAA0B,CAAC,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;;;GAOG;AACH,MAAM,UAAU,YAAY,CAC1B,IAAmB,EACnB,MAAqB,EACrB,OAAe,EACf,MAAoB;IAEpB,MAAM,KAAK,GAAG,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACjC,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;QACjB,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,KAAK,KAAK,GAAG,IAAI,MAAM,KAAK,IAAI,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;YAC5F,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;YACzC,IAAI,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC;gBACtB,OAAO,GAAG,CAAC;YACb,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,0DAA0D;QAC5D,CAAC;IACH,CAAC;IAED,OAAO,MAAM,KAAK,MAAM,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;AACrE,CAAC"}
|
package/dist/config.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Codegen } from "@swf2es/codegen";
|
|
2
2
|
import { type AirApplication, type CaptureHost, type EncryptedStoreHost, type FetchRequest, type FetchResult, type FileHost, type FileSystemHost, type ModuleCache, type SocketHost, type WebSocketHost } from "@swf2es/player";
|
|
3
3
|
import type { WebWorkerHost } from "@swf2es/player-hosts/workers";
|
|
4
|
+
import type { RelativeUrls } from "./attributes.js";
|
|
4
5
|
import type { Stage3DSurfaceFactory, Stage3DSurfaceLoader } from "./stage3d.js";
|
|
5
6
|
/** A flash.net.Socket's host and port, and the WebSocket relay that reaches it, as Ruffle's socketProxy lists them. */
|
|
6
7
|
export interface SocketProxy {
|
|
@@ -62,6 +63,15 @@ export interface Configuration {
|
|
|
62
63
|
loadPolicyFile?: (url: string) => void;
|
|
63
64
|
/** Security.sandboxType of the SWFs the element plays next: "remote" by default. */
|
|
64
65
|
sandboxType?: string;
|
|
66
|
+
/**
|
|
67
|
+
* What the SWFs' relative URLs resolve against where an element has no
|
|
68
|
+
* `base` and no `relativeurls` attribute: "page", the page's URL, as
|
|
69
|
+
* Flash Player's plug-in resolved them (the default, for a page that
|
|
70
|
+
* embeds its own SWFs), or "movie", each SWF's own, as its projector
|
|
71
|
+
* did, for a player that re-hosts SWFs from elsewhere, such as the site's
|
|
72
|
+
* or the desktop app's.
|
|
73
|
+
*/
|
|
74
|
+
relativeUrls?: RelativeUrls;
|
|
65
75
|
/**
|
|
66
76
|
* Whether the modules the compiler writes are kept in IndexedDB for the
|
|
67
77
|
* page's next visit, which then links them without compiling: off by
|
|
@@ -99,6 +109,13 @@ export interface Configuration {
|
|
|
99
109
|
* element fires `audioblocked` and `audiounblocked` either way.
|
|
100
110
|
*/
|
|
101
111
|
unmutePrompt?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Whether an element offers its performance meter in its context menu
|
|
114
|
+
* ("Show performance"), and shows it as the viewer last left it there: on
|
|
115
|
+
* by default; an element's `performancemeter` attribute decides for
|
|
116
|
+
* itself. The page may show the meter through `performanceMeter` either way.
|
|
117
|
+
*/
|
|
118
|
+
performanceMeter?: boolean;
|
|
102
119
|
/** The page's build, a short commit or a version, which the context menu's About item names. */
|
|
103
120
|
build?: string;
|
|
104
121
|
/**
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,OAAO,EAAiB,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EACL,KAAK,cAAc,EAGnB,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB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O,CAAC;AAClF,CAAC"}
|
package/dist/element.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import type { Codegen } from "@swf2es/codegen";
|
|
1
2
|
import { type AirApplication, type FileSystemHost, Player, Scripting } from "@swf2es/player";
|
|
2
3
|
import type { WebWorkerHost } from "@swf2es/player-hosts/workers";
|
|
3
4
|
import { AirApp } from "./air.js";
|
|
4
5
|
import { type AirFiles } from "./air-files.js";
|
|
5
6
|
import { type AirItems } from "./air-items.js";
|
|
6
|
-
import {
|
|
7
|
+
import { type MeterCorner } from "./meter.js";
|
|
8
|
+
import { type FrameListener, Playback } from "./playback.js";
|
|
7
9
|
import type { Stage3DSession } from "./stage3d.js";
|
|
8
10
|
import { UncaughtReports } from "./uncaught.js";
|
|
9
11
|
export declare const TAG = "swf2es-player";
|
|
@@ -13,6 +15,8 @@ export type SwfSource = string | URL | ArrayBuffer | Uint8Array;
|
|
|
13
15
|
declare const ElementBase: typeof HTMLElement;
|
|
14
16
|
/** What one load holds, let go of all at once when the next load or destroy comes. */
|
|
15
17
|
export interface Session {
|
|
18
|
+
/** The compiler its code is compiled by, an AS3 SWF's or an AVM1 SWF's; null for a SWF without code. */
|
|
19
|
+
codegen: Codegen | null;
|
|
16
20
|
scripting: Scripting | null;
|
|
17
21
|
player: Player | null;
|
|
18
22
|
playback: Playback | null;
|
|
@@ -53,6 +57,50 @@ export declare class Swf2esPlayerElement extends ElementBase {
|
|
|
53
57
|
* object, its extensions anew.
|
|
54
58
|
*/
|
|
55
59
|
get gl(): WebGL2RenderingContext | null;
|
|
60
|
+
/**
|
|
61
|
+
* Told after each animation frame what the player did in it: the SWF's
|
|
62
|
+
* frames played, its frame rate, and the ms its frames and the drawing
|
|
63
|
+
* took (FrameStats), for a page's performance meter. The object is the
|
|
64
|
+
* same each time, overwritten by the next frame's: copy what is kept.
|
|
65
|
+
* It holds for every SWF the element plays until set to null, as it
|
|
66
|
+
* starts; unset, the player measures nothing. There is one: setting it
|
|
67
|
+
* replaces the one before.
|
|
68
|
+
*/
|
|
69
|
+
get frameListener(): FrameListener | null;
|
|
70
|
+
set frameListener(listener: FrameListener | null);
|
|
71
|
+
/**
|
|
72
|
+
* Whether the performance meter shows over the player: fps against the
|
|
73
|
+
* SWF's rate, the player's ms in a frame, draw calls, the JS heap and the
|
|
74
|
+
* WebAssembly memories. Off by default. The context menu's "Show
|
|
75
|
+
* performance" turns it on and keeps the viewer's choice, for every
|
|
76
|
+
* element of the origin, in localStorage; setting this shows or hides it
|
|
77
|
+
* for the page alone, keeping nothing. The element fires
|
|
78
|
+
* `performancemeterchange` as it shows or hides.
|
|
79
|
+
*/
|
|
80
|
+
get performanceMeter(): boolean;
|
|
81
|
+
set performanceMeter(on: boolean);
|
|
82
|
+
/**
|
|
83
|
+
* The corner of the player element the meter sits in, which in a
|
|
84
|
+
* letterboxed or noScale player may be in the bars beside the stage:
|
|
85
|
+
* "top-left", the default, "top-right", "bottom-left" or "bottom-right";
|
|
86
|
+
* another value is ignored.
|
|
87
|
+
* The context menu's "Move performance meter" moves it to the next and
|
|
88
|
+
* keeps the viewer's choice; setting this moves it for the page alone,
|
|
89
|
+
* keeping nothing, and fires `performancemeterchange`.
|
|
90
|
+
*/
|
|
91
|
+
get performanceMeterCorner(): MeterCorner;
|
|
92
|
+
set performanceMeterCorner(corner: MeterCorner);
|
|
93
|
+
/**
|
|
94
|
+
* The bytes of the WebAssembly memories behind the player: its compiler's
|
|
95
|
+
* (`codegen`, 0 for a SWF without code or before a load), and the native
|
|
96
|
+
* modules' (`native`: bitmap kernels, tessellators, decoders, zlib), which
|
|
97
|
+
* every player on the page shares, its Flash Workers' left out, as their
|
|
98
|
+
* own threads hold them. A memory grows and never shrinks.
|
|
99
|
+
*/
|
|
100
|
+
get wasmMemory(): {
|
|
101
|
+
codegen: number;
|
|
102
|
+
native: number;
|
|
103
|
+
};
|
|
56
104
|
get src(): string;
|
|
57
105
|
set src(value: string);
|
|
58
106
|
connectedCallback(): void;
|
package/dist/element.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../src/element.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../src/element.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EACL,KAAK,cAAc,EAGnB,KAAK,cAAc,EAInB,MAAM,EACN,SAAS,EAEV,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAmB,MAAM,EAAyC,MAAM,UAAU,CAAC;AAC1F,OAAO,EAAE,KAAK,QAAQ,EAAY,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,KAAK,QAAQ,EAAY,MAAM,gBAAgB,CAAC;AAqBzD,OAAO,EAGL,KAAK,WAAW,EAOjB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,KAAK,aAAa,EAAa,QAAQ,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAIhD,eAAO,MAAM,GAAG,kBAAkB,CAAC;AAEnC,0EAA0E;AAC1E,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,GAAG,GAAG,WAAW,GAAG,UAAU,CAAC;AAEhE,gFAAgF;AAChF,QAAA,MAAM,WAAW,EAA2C,OAAO,WAAW,CAAC;AA6B/E,sFAAsF;AACtF,MAAM,WAAW,OAAO;IACtB,wGAAwG;IACxG,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;IAC5B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC1B,OAAO,E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,UAAU,IAAI;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAEpD;IAED,IAAI,GAAG,IAAI,MAAM,CAEhB;IAED,IAAI,GAAG,CAAC,KAAK,EAAE,MAAM,EAEpB;IAED,iBAAiB,IAAI,IAAI,CAUxB;IAED,oBAAoB,IAAI,IAAI,CAO3B;IAED,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CA0CrF;IAED;;;;;OAKG;IACH,IAAI,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAErC;IAED;;;;;;;;OAQG;IACH,OAAO,CACL,GAAG,EAAE,MAAM,EACX,OAAO,GAAE;QAAE,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;QAAC,SAAS,CAAC,EAAE,OAAO,CAAA;KAAO,GACnE,OAAO,CAAC,IAAI,CAAC,CAEf;IAunBD;;;;;OAKG;IACH,OAAO,IAAI,IAAI,CAEd;CA2CF;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,SAAM,GAAG,OAAO,CAYjD"}
|
package/dist/element.js
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
// <swf2es-player>: a SWF on a page as an <embed> showed one, with the
|
|
2
|
-
// embedding's attributes, a load() and destroy() of its own, and the
|
|
3
|
-
// SWF's ExternalInterface callbacks as methods on the element.
|
|
4
1
|
import { definesInput, definesSound, isAs3, readActions, readSwf, tags } from "@swf2es/format";
|
|
5
|
-
import { Avm1, Player, Scripting, } from "@swf2es/player";
|
|
2
|
+
import { Avm1, nativeMemory, Player, Scripting, } from "@swf2es/player";
|
|
6
3
|
import { AIR_DIRECTORIES, AirApp, airAppForSwf, elementWindow, namesAir } from "./air.js";
|
|
7
4
|
import { airFiles } from "./air-files.js";
|
|
8
5
|
import { airItems } from "./air-items.js";
|
|
9
|
-
import { cssLength, parseColor, parseFlashVars, quality, scriptAccess } from "./attributes.js";
|
|
6
|
+
import { cssLength, parseColor, parseFlashVars, quality, relativeBase, relativeUrls, scriptAccess, } from "./attributes.js";
|
|
10
7
|
import { captureHost, codegenForPlayer, configuration, moduleCacheOptions, playerLibraries, socketHost, } from "./config.js";
|
|
11
8
|
import { externalInterfaceHost } from "./external.js";
|
|
12
9
|
import { fetchFor, fetchMovie } from "./fetching.js";
|
|
13
10
|
import { scaleMode } from "./layout.js";
|
|
11
|
+
import { isMeterCorner, METER_STYLE, nextCorner, PerformanceMeter, storeCorner, storedCorner, storedMeter, storeMeter, } from "./meter.js";
|
|
14
12
|
import { Playback } from "./playback.js";
|
|
15
13
|
import { UncaughtReports } from "./uncaught.js";
|
|
16
14
|
import { UNMUTE_STYLE, UnmutePrompt } from "./unmute.js";
|
|
@@ -86,8 +84,18 @@ export class Swf2esPlayerElement extends ElementBase {
|
|
|
86
84
|
"quality",
|
|
87
85
|
"menu",
|
|
88
86
|
"unmuteprompt",
|
|
87
|
+
"performancemeter",
|
|
89
88
|
"allowcapture",
|
|
90
89
|
];
|
|
90
|
+
// For the tests alone, under a key no page types: whether anything hears the loop's frames,
|
|
91
|
+
// the page's frame listener or the meter, which the loop then measures for.
|
|
92
|
+
static {
|
|
93
|
+
Object.defineProperty(Swf2esPlayerElement.prototype, Symbol.for("swf2es.frameHook"), {
|
|
94
|
+
get() {
|
|
95
|
+
return !!this.#session?.playback?.onFrame;
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
}
|
|
91
99
|
#session = null;
|
|
92
100
|
#readiness = deferred();
|
|
93
101
|
/** The source the element last loaded, to tell a new src from the one playing. */
|
|
@@ -98,6 +106,18 @@ export class Swf2esPlayerElement extends ElementBase {
|
|
|
98
106
|
#stageSize = null;
|
|
99
107
|
/** The button over the player while its sound is held, made the first time it is. */
|
|
100
108
|
#prompt = null;
|
|
109
|
+
#frameListener = null;
|
|
110
|
+
/** The performance meter, made the first time it shows. */
|
|
111
|
+
#meter = null;
|
|
112
|
+
#meterShown = false;
|
|
113
|
+
/** Whether the meter shows by the viewer's choice, the menu's or the one kept, not a script's. */
|
|
114
|
+
#meterChosen = false;
|
|
115
|
+
/** The element's corner the meter sits in. */
|
|
116
|
+
#meterCorner = "top-left";
|
|
117
|
+
/** Whether a script put the meter in its corner, which the viewer's kept corner then leaves. */
|
|
118
|
+
#cornerSet = false;
|
|
119
|
+
/** The page's frame listener and the meter's together, made once both listen. */
|
|
120
|
+
#bothListeners = null;
|
|
101
121
|
constructor() {
|
|
102
122
|
super();
|
|
103
123
|
const shadow = this.attachShadow({ mode: "open" });
|
|
@@ -106,7 +126,8 @@ export class Swf2esPlayerElement extends ElementBase {
|
|
|
106
126
|
style.textContent =
|
|
107
127
|
":host { display: inline-block; position: relative; overflow: hidden; outline: none }" +
|
|
108
128
|
" .box { position: absolute; inset: 0; overflow: hidden }" +
|
|
109
|
-
UNMUTE_STYLE
|
|
129
|
+
UNMUTE_STYLE +
|
|
130
|
+
METER_STYLE;
|
|
110
131
|
this.#sizing = document.createElement("style");
|
|
111
132
|
this.#box = document.createElement("div");
|
|
112
133
|
this.#box.className = "box";
|
|
@@ -141,6 +162,190 @@ export class Swf2esPlayerElement extends ElementBase {
|
|
|
141
162
|
get gl() {
|
|
142
163
|
return this.#session?.playback?.gl ?? null;
|
|
143
164
|
}
|
|
165
|
+
/**
|
|
166
|
+
* Told after each animation frame what the player did in it: the SWF's
|
|
167
|
+
* frames played, its frame rate, and the ms its frames and the drawing
|
|
168
|
+
* took (FrameStats), for a page's performance meter. The object is the
|
|
169
|
+
* same each time, overwritten by the next frame's: copy what is kept.
|
|
170
|
+
* It holds for every SWF the element plays until set to null, as it
|
|
171
|
+
* starts; unset, the player measures nothing. There is one: setting it
|
|
172
|
+
* replaces the one before.
|
|
173
|
+
*/
|
|
174
|
+
get frameListener() {
|
|
175
|
+
return this.#frameListener;
|
|
176
|
+
}
|
|
177
|
+
set frameListener(listener) {
|
|
178
|
+
this.#frameListener = typeof listener === "function" ? listener : null;
|
|
179
|
+
this.#listen();
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Whether the performance meter shows over the player: fps against the
|
|
183
|
+
* SWF's rate, the player's ms in a frame, draw calls, the JS heap and the
|
|
184
|
+
* WebAssembly memories. Off by default. The context menu's "Show
|
|
185
|
+
* performance" turns it on and keeps the viewer's choice, for every
|
|
186
|
+
* element of the origin, in localStorage; setting this shows or hides it
|
|
187
|
+
* for the page alone, keeping nothing. The element fires
|
|
188
|
+
* `performancemeterchange` as it shows or hides.
|
|
189
|
+
*/
|
|
190
|
+
get performanceMeter() {
|
|
191
|
+
return this.#meterShown;
|
|
192
|
+
}
|
|
193
|
+
set performanceMeter(on) {
|
|
194
|
+
this.#meterChosen = false;
|
|
195
|
+
this.#showMeter(Boolean(on));
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* The corner of the player element the meter sits in, which in a
|
|
199
|
+
* letterboxed or noScale player may be in the bars beside the stage:
|
|
200
|
+
* "top-left", the default, "top-right", "bottom-left" or "bottom-right";
|
|
201
|
+
* another value is ignored.
|
|
202
|
+
* The context menu's "Move performance meter" moves it to the next and
|
|
203
|
+
* keeps the viewer's choice; setting this moves it for the page alone,
|
|
204
|
+
* keeping nothing, and fires `performancemeterchange`.
|
|
205
|
+
*/
|
|
206
|
+
get performanceMeterCorner() {
|
|
207
|
+
return this.#meterCorner;
|
|
208
|
+
}
|
|
209
|
+
set performanceMeterCorner(corner) {
|
|
210
|
+
if (isMeterCorner(corner)) {
|
|
211
|
+
this.#cornerSet = true;
|
|
212
|
+
this.#placeMeter(corner);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
/** The meter moved to `corner`, the page told where `tell` and it moved. */
|
|
216
|
+
#placeMeter(corner, tell = true) {
|
|
217
|
+
if (corner === this.#meterCorner) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
this.#meterCorner = corner;
|
|
221
|
+
this.#meter?.place(corner);
|
|
222
|
+
if (tell) {
|
|
223
|
+
this.#changedMeter();
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
#changedMeter() {
|
|
227
|
+
dispatch(this, new CustomEvent("performancemeterchange", {
|
|
228
|
+
detail: { shown: this.#meterShown, corner: this.#meterCorner },
|
|
229
|
+
}));
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* The viewer's kept choice applied where the menu offers the meter, as a
|
|
233
|
+
* SWF starts and as the offer changes: read then, not as the element is
|
|
234
|
+
* connected, so that a page's configure() after its markup holds. Not
|
|
235
|
+
* offered, a meter the viewer's choice showed goes; a script's stays.
|
|
236
|
+
*/
|
|
237
|
+
#applyChoice() {
|
|
238
|
+
const shown = this.#meterShown;
|
|
239
|
+
const corner = this.#meterCorner;
|
|
240
|
+
if (!this.#cornerSet) {
|
|
241
|
+
this.#placeMeter(this.#meterOffered() ? storedCorner() : "top-left", false);
|
|
242
|
+
}
|
|
243
|
+
if (this.#meterOffered()) {
|
|
244
|
+
if (!this.#meterShown && storedMeter()) {
|
|
245
|
+
this.#meterChosen = true;
|
|
246
|
+
this.#showMeter(true, false);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
else if (this.#meterChosen && this.#meterShown) {
|
|
250
|
+
this.#meterChosen = false;
|
|
251
|
+
this.#showMeter(false, false);
|
|
252
|
+
}
|
|
253
|
+
// Told once, and only of what shows differently: not of a hidden meter's corner.
|
|
254
|
+
if (this.#meterShown !== shown || (this.#meterShown && this.#meterCorner !== corner)) {
|
|
255
|
+
this.#changedMeter();
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
/** The meter shown or hidden, the page told where `tell`. */
|
|
259
|
+
#showMeter(on, tell = true) {
|
|
260
|
+
const parent = this.#box.parentNode;
|
|
261
|
+
if (on === this.#meterShown || !parent) {
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
this.#meterShown = on;
|
|
265
|
+
if (on) {
|
|
266
|
+
this.#meter ??= new PerformanceMeter(parent, () => this.wasmMemory);
|
|
267
|
+
this.#meter.place(this.#meterCorner);
|
|
268
|
+
const playback = this.#session?.playback;
|
|
269
|
+
this.#meter.attach(playback?.gl ?? null, !!playback);
|
|
270
|
+
}
|
|
271
|
+
this.#meter?.show(on);
|
|
272
|
+
this.#listen();
|
|
273
|
+
if (tell) {
|
|
274
|
+
this.#changedMeter();
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* The context menu's items for the meter, where it offers them: one to
|
|
279
|
+
* show or hide it and, while it shows, one to move it to the next corner.
|
|
280
|
+
* Flash's menus had no submenus, nor has this one. Each is the viewer's own
|
|
281
|
+
* choice, kept for the next time.
|
|
282
|
+
*/
|
|
283
|
+
#meterMenu() {
|
|
284
|
+
if (!this.#meterOffered()) {
|
|
285
|
+
return [];
|
|
286
|
+
}
|
|
287
|
+
const items = [
|
|
288
|
+
{
|
|
289
|
+
caption: this.#meterShown ? "Hide performance" : "Show performance",
|
|
290
|
+
enabled: true,
|
|
291
|
+
select: () => {
|
|
292
|
+
const on = !this.#meterShown;
|
|
293
|
+
storeMeter(on);
|
|
294
|
+
this.#meterChosen = on;
|
|
295
|
+
this.#showMeter(on);
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
];
|
|
299
|
+
if (this.#meterShown) {
|
|
300
|
+
items.push({
|
|
301
|
+
caption: "Move performance meter",
|
|
302
|
+
enabled: true,
|
|
303
|
+
select: () => {
|
|
304
|
+
const corner = nextCorner(this.#meterCorner);
|
|
305
|
+
storeCorner(corner);
|
|
306
|
+
this.#cornerSet = false;
|
|
307
|
+
this.#placeMeter(corner);
|
|
308
|
+
},
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
return items;
|
|
312
|
+
}
|
|
313
|
+
/** Whether the context menu offers the meter, by the element's attribute or the page's configuration. */
|
|
314
|
+
#meterOffered() {
|
|
315
|
+
const own = attribute(this, "performancemeter")?.trim().toLowerCase();
|
|
316
|
+
return own === "true" || (own !== "false" && configuration().performanceMeter !== false);
|
|
317
|
+
}
|
|
318
|
+
/** The playback told of each frame by whichever listen, the page's listener and the meter's. */
|
|
319
|
+
#listen() {
|
|
320
|
+
const playback = this.#session?.playback;
|
|
321
|
+
if (playback) {
|
|
322
|
+
playback.onFrame = this.#frameHook();
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
#frameHook() {
|
|
326
|
+
const meter = this.#meterShown ? this.#meter : null;
|
|
327
|
+
if (!meter) {
|
|
328
|
+
return this.#frameListener;
|
|
329
|
+
}
|
|
330
|
+
if (!this.#frameListener) {
|
|
331
|
+
return meter.heard;
|
|
332
|
+
}
|
|
333
|
+
this.#bothListeners ??= (stats) => {
|
|
334
|
+
this.#meter?.heard(stats);
|
|
335
|
+
this.#frameListener?.(stats);
|
|
336
|
+
};
|
|
337
|
+
return this.#bothListeners;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* The bytes of the WebAssembly memories behind the player: its compiler's
|
|
341
|
+
* (`codegen`, 0 for a SWF without code or before a load), and the native
|
|
342
|
+
* modules' (`native`: bitmap kernels, tessellators, decoders, zlib), which
|
|
343
|
+
* every player on the page shares, its Flash Workers' left out, as their
|
|
344
|
+
* own threads hold them. A memory grows and never shrinks.
|
|
345
|
+
*/
|
|
346
|
+
get wasmMemory() {
|
|
347
|
+
return { codegen: this.#session?.codegen?.memoryBytes() ?? 0, native: nativeMemory() };
|
|
348
|
+
}
|
|
144
349
|
get src() {
|
|
145
350
|
return attribute(this, "src") ?? "";
|
|
146
351
|
}
|
|
@@ -191,6 +396,12 @@ export class Swf2esPlayerElement extends ElementBase {
|
|
|
191
396
|
this.#showPrompt();
|
|
192
397
|
return;
|
|
193
398
|
}
|
|
399
|
+
// Taken from the viewer, the meter they turned on goes too, their choice kept for elsewhere;
|
|
400
|
+
// given back, it shows again.
|
|
401
|
+
if (name === "performancemeter") {
|
|
402
|
+
this.#applyChoice();
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
194
405
|
this.#session?.playback?.changed();
|
|
195
406
|
}
|
|
196
407
|
/**
|
|
@@ -221,6 +432,7 @@ export class Swf2esPlayerElement extends ElementBase {
|
|
|
221
432
|
}
|
|
222
433
|
const ready = this.#readiness;
|
|
223
434
|
const session = {
|
|
435
|
+
codegen: null,
|
|
224
436
|
scripting: null,
|
|
225
437
|
player: null,
|
|
226
438
|
playback: null,
|
|
@@ -275,6 +487,8 @@ export class Swf2esPlayerElement extends ElementBase {
|
|
|
275
487
|
const base = attribute(this, "base");
|
|
276
488
|
let bytes;
|
|
277
489
|
let url;
|
|
490
|
+
// From the URL it came from, where it came from one.
|
|
491
|
+
let fetched = null;
|
|
278
492
|
if (session.air) {
|
|
279
493
|
// The content SWF, by the app: URL adl names it with.
|
|
280
494
|
const content = session.air.app.descriptor.content;
|
|
@@ -286,11 +500,12 @@ export class Swf2esPlayerElement extends ElementBase {
|
|
|
286
500
|
}
|
|
287
501
|
else if (typeof source === "string" || source instanceof URL) {
|
|
288
502
|
({ bytes, url } = await fetchMovie(new URL(source, pageUrl).href, session.abort.signal));
|
|
503
|
+
fetched = url;
|
|
289
504
|
}
|
|
290
505
|
else {
|
|
291
|
-
// A copy: the page may reuse its buffer.
|
|
506
|
+
// A copy: the page may reuse its buffer; its URL is `base`'s, else the page's.
|
|
292
507
|
bytes = new Uint8Array(source instanceof Uint8Array ? source : new Uint8Array(source));
|
|
293
|
-
url = base
|
|
508
|
+
url = relativeBase(base, null, pageUrl, "movie") ?? pageUrl;
|
|
294
509
|
}
|
|
295
510
|
if (!current()) {
|
|
296
511
|
return;
|
|
@@ -303,6 +518,10 @@ export class Swf2esPlayerElement extends ElementBase {
|
|
|
303
518
|
this.#playAsAir(session, app, [], true);
|
|
304
519
|
url = `app:/${encodeURIComponent(app.descriptor.content)}`;
|
|
305
520
|
}
|
|
521
|
+
// Where every SWF's relative URLs resolve: an AIR application's each its own.
|
|
522
|
+
const baseUrl = session.air
|
|
523
|
+
? null
|
|
524
|
+
: relativeBase(base, fetched, pageUrl, relativeUrls(attribute(this, "relativeurls"), configuration().relativeUrls));
|
|
306
525
|
// What the application wrote and kept when it last played, before it plays.
|
|
307
526
|
if (session.air) {
|
|
308
527
|
await Promise.all([session.air.files.ready, session.air.items.ready]);
|
|
@@ -339,7 +558,8 @@ export class Swf2esPlayerElement extends ElementBase {
|
|
|
339
558
|
return;
|
|
340
559
|
}
|
|
341
560
|
session.workers = host;
|
|
342
|
-
session.
|
|
561
|
+
session.codegen = codegen;
|
|
562
|
+
session.scripting = this.#scripting(session, codegen, url, baseUrl, pageUrl, host);
|
|
343
563
|
if (stage3D && stage3DModule) {
|
|
344
564
|
session.stage3D = new stage3DModule.Stage3DSession(this.#box, session.scripting, stage3D, () => session.playback?.invalidate());
|
|
345
565
|
}
|
|
@@ -357,16 +577,17 @@ export class Swf2esPlayerElement extends ElementBase {
|
|
|
357
577
|
if (!current()) {
|
|
358
578
|
return;
|
|
359
579
|
}
|
|
580
|
+
session.codegen = codegen;
|
|
360
581
|
// Its URL keys its SharedObjects, as a page's AS3 SWFs' are. Its
|
|
361
582
|
// fscommand, getURL and ExternalInterface reach the page as an AS3
|
|
362
583
|
// SWF's do: "quit" goes to the page, as a plug-in's did, and stops
|
|
363
584
|
// nothing.
|
|
364
585
|
const { internal, offline, allows, objectID } = this.#access(pageUrl);
|
|
365
|
-
const base = attribute(this, "base");
|
|
366
586
|
avm1 = new Avm1(codegen, {
|
|
367
587
|
url,
|
|
368
588
|
parameters: parseFlashVars(attribute(this, "flashvars")),
|
|
369
|
-
|
|
589
|
+
// Without a base of the page's, its own URL.
|
|
590
|
+
base: baseUrl ?? undefined,
|
|
370
591
|
// XML, LoadVars and XMLSocket reach the network as an AS3 SWF's loads and sockets do.
|
|
371
592
|
fetch: fetchFor(session, offline),
|
|
372
593
|
socket: offline ? undefined : socketHost(),
|
|
@@ -402,12 +623,18 @@ export class Swf2esPlayerElement extends ElementBase {
|
|
|
402
623
|
session.player.quality = quality(attribute(this, "quality"));
|
|
403
624
|
session.player.showDefaultContextMenu = attribute(this, "menu")?.toLowerCase() !== "false";
|
|
404
625
|
session.player.build = configuration().build ?? null;
|
|
626
|
+
session.player.hostMenu = () => this.#meterMenu();
|
|
405
627
|
const playback = await Playback.create(this.#box, session.player, session.scripting, () => this.#look(), (error) => this.#report(session, error), session.stage3D);
|
|
406
628
|
if (!current()) {
|
|
407
629
|
playback.destroy();
|
|
408
630
|
return;
|
|
409
631
|
}
|
|
410
632
|
session.playback = playback;
|
|
633
|
+
playback.onFrame = this.#frameHook();
|
|
634
|
+
if (this.#meterShown) {
|
|
635
|
+
this.#meter?.attach(playback.gl, true);
|
|
636
|
+
}
|
|
637
|
+
this.#applyChoice();
|
|
411
638
|
// The workers started ahead, loaded before a script may wait for one;
|
|
412
639
|
// a script that never says it loaded does not keep the SWF from playing.
|
|
413
640
|
if (session.workers) {
|
|
@@ -476,12 +703,11 @@ export class Swf2esPlayerElement extends ElementBase {
|
|
|
476
703
|
this.#session?.player?.audio?.resume?.();
|
|
477
704
|
}
|
|
478
705
|
/** The scripting of a load from `url`, its ExternalInterface and fscommand the page's only for the SWFs it lets script it. */
|
|
479
|
-
#scripting(session, codegen, url, pageUrl, workerHost) {
|
|
706
|
+
#scripting(session, codegen, url, base, pageUrl, workerHost) {
|
|
480
707
|
const { internal, offline, allows, objectID } = this.#access(pageUrl);
|
|
481
|
-
const base = attribute(this, "base");
|
|
482
708
|
const scripting = new Scripting(codegen, {
|
|
483
709
|
url,
|
|
484
|
-
base: base
|
|
710
|
+
base: base ?? undefined,
|
|
485
711
|
parameters: parseFlashVars(attribute(this, "flashvars")),
|
|
486
712
|
fetch: fetchFor(session, offline),
|
|
487
713
|
loadPolicyFile: configuration().loadPolicyFile,
|
|
@@ -757,6 +983,9 @@ export class Swf2esPlayerElement extends ElementBase {
|
|
|
757
983
|
}
|
|
758
984
|
session.callbacks.clear();
|
|
759
985
|
session.abort.abort();
|
|
986
|
+
if (session.playback) {
|
|
987
|
+
this.#meter?.attach(null, false);
|
|
988
|
+
}
|
|
760
989
|
session.playback?.destroy();
|
|
761
990
|
session.stage3D?.destroy();
|
|
762
991
|
session.player?.destroy();
|