@vnejs/module.controller.audio 0.2.5 → 0.2.7
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/index.d.ts +0 -1
- package/dist/index.js +0 -4
- package/dist/types.d.ts +1 -3
- package/package.json +1 -1
- package/src/index.ts +3 -5
- package/src/types.ts +1 -3
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -19,16 +19,12 @@ export class ModuleControllerAudio extends ModuleCore {
|
|
|
19
19
|
this.PARAMS_ALL = { layer: "view", name: this.AUDIO_NAME, duration: this.AUDIO_START_DURATION };
|
|
20
20
|
this.PARAMS_DURATION = { duration: this.AUDIO_START_DURATION };
|
|
21
21
|
};
|
|
22
|
-
getDefaultState = () => ({ isShow: false });
|
|
23
22
|
onShow = () => {
|
|
24
|
-
this.updateState({ isShow: true });
|
|
25
23
|
this.isPlaying = true;
|
|
26
24
|
this.emit(this.EVENTS.AUDIO.GLOBAL_PAUSE, this.PARAMS_DURATION);
|
|
27
25
|
this.emit(this.EVENTS.AUDIO.PLAY, { ...this.PARAMS_ALL, volume: this.getRealVolume() });
|
|
28
26
|
};
|
|
29
27
|
onHide = () => {
|
|
30
|
-
if (this.state.isShow)
|
|
31
|
-
this.updateState({ isShow: false });
|
|
32
28
|
this.isPlaying = false;
|
|
33
29
|
this.emit(this.EVENTS.AUDIO.STOP, this.PARAMS_ALL);
|
|
34
30
|
this.emit(this.EVENTS.AUDIO.GLOBAL_RESUME, this.PARAMS_DURATION);
|
package/dist/types.d.ts
CHANGED
|
@@ -4,6 +4,4 @@ export type ModuleControllerAudioEvents = ModuleCoreEvents & Record<AudioPluginN
|
|
|
4
4
|
export type ModuleControllerAudioConstants = ModuleCoreConstants;
|
|
5
5
|
export type ModuleControllerAudioSettings = ModuleCoreSettings;
|
|
6
6
|
export type ModuleControllerAudioParams = ModuleCoreParams;
|
|
7
|
-
export type ModuleControllerAudioState =
|
|
8
|
-
isShow: boolean;
|
|
9
|
-
};
|
|
7
|
+
export type ModuleControllerAudioState = object;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -60,24 +60,22 @@ export abstract class ModuleControllerAudio<
|
|
|
60
60
|
this.PARAMS_DURATION = { duration: this.AUDIO_START_DURATION };
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
-
getDefaultState = (): TState => ({ isShow: false }) as TState;
|
|
64
|
-
|
|
65
63
|
onShow = () => {
|
|
66
|
-
this.updateState({ isShow: true } as Partial<TState>);
|
|
67
64
|
this.isPlaying = true;
|
|
68
65
|
this.emit(this.EVENTS.AUDIO.GLOBAL_PAUSE, this.PARAMS_DURATION);
|
|
69
66
|
this.emit(this.EVENTS.AUDIO.PLAY, { ...this.PARAMS_ALL, volume: this.getRealVolume() });
|
|
70
67
|
};
|
|
71
|
-
onHide = () => {
|
|
72
|
-
if (this.state.isShow) this.updateState({ isShow: false } as Partial<TState>);
|
|
73
68
|
|
|
69
|
+
onHide = () => {
|
|
74
70
|
this.isPlaying = false;
|
|
75
71
|
this.emit(this.EVENTS.AUDIO.STOP, this.PARAMS_ALL);
|
|
76
72
|
this.emit(this.EVENTS.AUDIO.GLOBAL_RESUME, this.PARAMS_DURATION);
|
|
77
73
|
};
|
|
74
|
+
|
|
78
75
|
onLoad = () => void this.emit(this.EVENTS.AUDIO.MEDIA_LOAD, this.PARAMS_ALL);
|
|
79
76
|
|
|
80
77
|
onVolumeChanged = () => this.isPlaying && this.emitVolume();
|
|
78
|
+
|
|
81
79
|
onSettingsChanged = ({ name }: SettingsChangedResult) => name === this.VOLUME_SETTING && this.isPlaying && this.emitVolume();
|
|
82
80
|
|
|
83
81
|
emitVolume = () => this.emit(this.EVENTS.AUDIO.VOLUME, { layer: "view", name: this.AUDIO_NAME, volume: this.getRealVolume() });
|
package/src/types.ts
CHANGED