@vnejs/plugins.views.video 0.1.8 → 0.1.9

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/modules/video.js CHANGED
@@ -16,7 +16,7 @@ export class Video extends ModuleController {
16
16
  this.on(this.EVENTS.VIDEO.GET, this.onVideoGet);
17
17
  this.on(this.EVENTS.VIDEO.SET, this.onVideoSet);
18
18
 
19
- this.on(this.EVENTS.STATE.SET, this.onUpdateStateFromGlobalState);
19
+ this.on(this.EVENTS.STATE.SET, this.onStateSet);
20
20
  this.on(this.EVENTS.STATE.CLEAR, this.onHide);
21
21
  };
22
22
 
@@ -29,6 +29,7 @@ export class Video extends ModuleController {
29
29
  beforeShow = () => this.emit(this.EVENTS.INTERFACE.TEXT_HIDE);
30
30
  afterHide = async () => {
31
31
  await this.emit(this.EVENTS.INTERACT.POP, { key: this.name });
32
+ this.updateStateAndViewFast({ src: "" });
32
33
  this.emit(this.EVENTS.SCENARIO.NEXT, { module: this.name });
33
34
  };
34
35
 
@@ -39,7 +40,6 @@ export class Video extends ModuleController {
39
40
  await this.emit(this.EVENTS.VIDEO.SHOW);
40
41
  await this.emit(this.EVENTS.INTERACT.PUSH, { key: this.name, handler: this.emitHide });
41
42
  };
42
-
43
43
  onPreloadLineHandler = ({ line, priority = this.CONST.MEDIA.PRIORITIES.BACKGROUND } = {}) => {
44
44
  const { name = "" } = line.match(this.CONST.VIDEO.LINE_REG).groups;
45
45
 
@@ -47,9 +47,7 @@ export class Video extends ModuleController {
47
47
  };
48
48
 
49
49
  onVideoLoad = ({ name = "", priority = this.CONST.MEDIA.PRIORITIES.BACKGROUND } = {}) => this.emit(this.EVENTS.MEDIA.LOAD, this.getMediaArgs(name, priority));
50
-
51
50
  onVideoGet = ({ name = "" } = {}) => this.emitOne(this.EVENTS.MEDIA.GET, this.getMediaArgs(name));
52
-
53
51
  onVideoSet = async ({ name = "" } = {}) => {
54
52
  const video = await this.emitOne(this.EVENTS.VIDEO.GET, { name });
55
53
 
@@ -58,6 +56,8 @@ export class Video extends ModuleController {
58
56
  this.updateState({ src: video.src });
59
57
  };
60
58
 
59
+ onStateSet = async ({ [this.name]: state } = {}) => this.setState(await this.emitOne(this.EVENTS.VENDORS.CLONE, state));
60
+
61
61
  getMediaArgs = (name, priority) => {
62
62
  const [type, quality] = [this.CONST.MEDIA.TYPES.VIDEO, this.shared.settings[this.SETTINGS.LAYER.QUALITY]];
63
63
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnejs/plugins.views.video",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
package/view/index.jsx CHANGED
@@ -39,11 +39,7 @@ const VideoView = ({ store, onMount, ...props } = {}) => {
39
39
  const propsScreen = useMemo(() => ({ ...props.PARAMS.VIDEO.VIEW_PROPS.screen, onClick, isShow, isForce }), [isShow, isForce]);
40
40
  const propsVideo = useMemo(() => ({ ...VIDEO_PROPS, src, ref: videoRef, onEnded: onClick }), [src]);
41
41
 
42
- return (
43
- <Screen {...propsScreen}>
44
- <video {...propsVideo} />
45
- </Screen>
46
- );
42
+ return <Screen {...propsScreen}>{src && <video {...propsVideo} />}</Screen>;
47
43
  };
48
44
 
49
45
  export const render = (props, root) => createRoot(root).render(<VideoView {...props} />);