@revideo/2d 0.5.4 → 0.5.5-alpha.1062
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/editor/editor/tsconfig.build.tsbuildinfo +1 -1
- package/lib/components/Asset.d.ts.map +1 -1
- package/lib/components/Asset.js +4 -2
- package/lib/components/Media.d.ts +1 -1
- package/lib/components/Media.d.ts.map +1 -1
- package/lib/components/Media.js +9 -8
- package/lib/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/src/lib/components/Asset.ts +4 -1
- package/src/lib/components/Media.ts +10 -6
|
@@ -39,9 +39,7 @@ export abstract class Media extends Asset {
|
|
|
39
39
|
@signal()
|
|
40
40
|
protected declare readonly playing: SimpleSignal<boolean, this>;
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
@signal()
|
|
44
|
-
protected declare readonly volume: SimpleSignal<number, this>;
|
|
42
|
+
protected readonly volume: number = 1;
|
|
45
43
|
|
|
46
44
|
protected lastTime = -1;
|
|
47
45
|
|
|
@@ -50,6 +48,7 @@ export abstract class Media extends Asset {
|
|
|
50
48
|
if (props.play) {
|
|
51
49
|
this.play();
|
|
52
50
|
}
|
|
51
|
+
this.volume = props.volume ?? 1;
|
|
53
52
|
}
|
|
54
53
|
|
|
55
54
|
public isPlaying(): boolean {
|
|
@@ -65,7 +64,7 @@ export abstract class Media extends Asset {
|
|
|
65
64
|
}
|
|
66
65
|
|
|
67
66
|
public getVolume(): number {
|
|
68
|
-
return this.
|
|
67
|
+
return this.volume;
|
|
69
68
|
}
|
|
70
69
|
|
|
71
70
|
public override dispose() {
|
|
@@ -109,9 +108,14 @@ export abstract class Media extends Asset {
|
|
|
109
108
|
}
|
|
110
109
|
|
|
111
110
|
protected setVolume(volume: number) {
|
|
112
|
-
if (volume < 0
|
|
111
|
+
if (volume < 0) {
|
|
112
|
+
console.warn(
|
|
113
|
+
`volumes cannot be negative - the value will be clamped to 0.`,
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
if (volume > 1) {
|
|
113
117
|
console.warn(
|
|
114
|
-
|
|
118
|
+
`the browser does not natively support volumes higher than 1 - your preview will have a volume of 1, but your exported video will have a volume of ${volume}`,
|
|
115
119
|
);
|
|
116
120
|
}
|
|
117
121
|
this.mediaElement().volume = Math.min(Math.max(volume, 0), 1);
|