@shijiu/jsview-vue 2.0.1021 → 2.0.1073
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/package.json +4 -3
- package/utils/JsViewEngineWidget/CheckType.js +82 -0
- package/utils/JsViewEngineWidget/MetroWidget/AnimationManager.ts +72 -0
- package/utils/JsViewEngineWidget/MetroWidget/Const.ts +24 -0
- package/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue +295 -0
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +110 -1651
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.js +1867 -0
- package/utils/JsViewEngineWidget/MetroWidget/PageUpdater.ts +111 -0
- package/utils/JsViewEngineWidget/MetroWidget/RenderItem.ts +153 -0
- package/utils/JsViewEngineWidget/MetroWidget/VisibleInfo.ts +43 -0
- package/utils/JsViewEngineWidget/MetroWidget/WidgetRectInfo.ts +49 -0
- package/utils/JsViewEngineWidget/TemplateParser/CommonMetroTemplate.ts +1424 -0
- package/utils/JsViewEngineWidget/TemplateParser/Fence.ts +135 -0
- package/utils/JsViewEngineWidget/TemplateParser/ListMetroTemplate.ts +177 -0
- package/utils/JsViewEngineWidget/TemplateParser/MetroTemplate.ts +334 -0
- package/utils/JsViewEngineWidget/TemplateParser/TemplateItemAdder.ts +147 -0
- package/utils/JsViewEngineWidget/TemplateParser/index.ts +4 -0
- package/utils/JsViewEngineWidget/{WidgetCommon.js → WidgetCommon.ts} +64 -71
- package/utils/JsViewEngineWidget/index.js +2 -1
- package/utils/JsViewPlugin/JsvAudio/AudioProxy.js +26 -1
- package/utils/JsViewPlugin/JsvAudio/JsvAudio.vue +120 -133
- package/utils/JsViewPlugin/JsvAudio/JsvAudioBrowser.vue +11 -7
- package/utils/JsViewPlugin/JsvPlayer/GetVersion.js +1 -1
- package/utils/JsViewPlugin/JsvPlayer/JsvPlayerBrowser.vue +379 -41
- package/utils/JsViewPlugin/JsvPlayer/version.mjs +5 -5
- package/utils/JsViewVueTools/JsvHashHistory.js +2 -1
- package/utils/JsViewVueWidget/JsvRadarChart.vue +220 -0
- package/utils/JsViewVueWidget/JsvSystemAudio.vue +76 -44
- package/utils/JsViewVueWidget/index.js +1 -0
- package/utils/JsViewEngineWidget/MetroWidget/Const.js +0 -11
- package/utils/JsViewEngineWidget/MetroWidget/PageUpdater.js +0 -136
- package/utils/JsViewEngineWidget/MetroWidget/ToolFunctions.js +0 -18
- package/utils/JsViewEngineWidget/TemplateParser.js +0 -2004
|
@@ -1,151 +1,138 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { sAudioManager } from "./AudioProxy.js";
|
|
1
|
+
<script setup>
|
|
2
|
+
import { sAudioManager, getKeyToken } from "./AudioProxy.js";
|
|
3
|
+
import { onBeforeUnmount } from "vue";
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return {};
|
|
38
|
-
},
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
/**
|
|
7
|
+
* 回调函数,播放器对象通知接口
|
|
8
|
+
* @param {Object} video对象,可以通过此video对象调用video相关属性和方法,具体属性和方法定义见JsvMedia.js文件里相关说明。
|
|
9
|
+
*/
|
|
10
|
+
onRef: { type: Function, default: () => {} },
|
|
11
|
+
/**
|
|
12
|
+
* 属性,Boolean类型,true表示自动播放,默认false。
|
|
13
|
+
*/
|
|
14
|
+
autoplay: { type: Boolean, default: false },
|
|
15
|
+
/**
|
|
16
|
+
* 属性,String类型,播放器实例索引,同样的key使用同一个播放器实例。
|
|
17
|
+
*/
|
|
18
|
+
playerKey: { type: String, default: null },
|
|
19
|
+
/**
|
|
20
|
+
* 属性,Boolean类型,true表示静音,默认false。
|
|
21
|
+
*/
|
|
22
|
+
muted: { type: Boolean, default: false },
|
|
23
|
+
/**
|
|
24
|
+
* 属性,Boolean类型,true表示循环播放,默认false。
|
|
25
|
+
*/
|
|
26
|
+
loop: { type: Boolean, default: false },
|
|
27
|
+
/**
|
|
28
|
+
* 属性,String类型,播放地址。
|
|
29
|
+
*/
|
|
30
|
+
src: { type: String, default: "" },
|
|
31
|
+
/**
|
|
32
|
+
* 回调函数,播放结束时通过此回调接口通知。
|
|
33
|
+
*/
|
|
34
|
+
onEnded: {
|
|
35
|
+
type: Function,
|
|
36
|
+
default: () => {
|
|
37
|
+
return {};
|
|
39
38
|
},
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
/**
|
|
51
|
-
* 回调函数,开始加载,设置完播放地址后,上报此事件。
|
|
52
|
-
*/
|
|
53
|
-
onLoadStart: {
|
|
54
|
-
type: Function,
|
|
55
|
-
default: () => {
|
|
56
|
-
return {};
|
|
57
|
-
},
|
|
39
|
+
},
|
|
40
|
+
/**
|
|
41
|
+
* 回调函数,播放错误时通过此接口通知。
|
|
42
|
+
* @param {int} 错误类型,当前定义了四种错误。1是异常中断;2是网络错误;3是解码错误;4是格式不支持。
|
|
43
|
+
*/
|
|
44
|
+
onError: {
|
|
45
|
+
type: Function,
|
|
46
|
+
default: () => {
|
|
47
|
+
return {};
|
|
58
48
|
},
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
49
|
+
},
|
|
50
|
+
/**
|
|
51
|
+
* 回调函数,开始加载,设置完播放地址后,上报此事件。
|
|
52
|
+
*/
|
|
53
|
+
onLoadStart: {
|
|
54
|
+
type: Function,
|
|
55
|
+
default: () => {
|
|
56
|
+
return {};
|
|
67
57
|
},
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
58
|
+
},
|
|
59
|
+
/**
|
|
60
|
+
* 回调函数,视频准备好后触发。
|
|
61
|
+
*/
|
|
62
|
+
onLoadedMetaData: {
|
|
63
|
+
type: Function,
|
|
64
|
+
default: () => {
|
|
65
|
+
return {};
|
|
76
66
|
},
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
67
|
+
},
|
|
68
|
+
/**
|
|
69
|
+
* 回调函数,视频准备好后触发,这个时候可以正常seek。
|
|
70
|
+
*/
|
|
71
|
+
onLoad: {
|
|
72
|
+
type: Function,
|
|
73
|
+
default: () => {
|
|
74
|
+
return {};
|
|
85
75
|
},
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
76
|
+
},
|
|
77
|
+
/**
|
|
78
|
+
* 回调函数,音频失去焦点后触发此事件,可能会导致pause(点播)或者离开频道(直播)。
|
|
79
|
+
*/
|
|
80
|
+
onAudioFocusLoss: {
|
|
81
|
+
type: Function,
|
|
82
|
+
default: () => {
|
|
83
|
+
return {};
|
|
94
84
|
},
|
|
95
85
|
},
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
86
|
+
/**
|
|
87
|
+
* 回调函数,音频获取焦点后触发此事件,可能会触发resume(点播)或者加入频道(直播)。
|
|
88
|
+
*/
|
|
89
|
+
onAudioFocusGain: {
|
|
90
|
+
type: Function,
|
|
91
|
+
default: () => {
|
|
92
|
+
return {};
|
|
93
|
+
},
|
|
100
94
|
},
|
|
101
|
-
|
|
102
|
-
let key = "JsvAudio_" + Math.floor(Math.random() * 10000);
|
|
103
|
-
if (this.playerKey) {
|
|
104
|
-
key = this.playerKey;
|
|
105
|
-
}
|
|
106
|
-
console.log("player key:" + key);
|
|
95
|
+
});
|
|
107
96
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
97
|
+
let key = "JsvAudio_" + getKeyToken();
|
|
98
|
+
if (props.playerKey) {
|
|
99
|
+
key = props.playerKey;
|
|
100
|
+
}
|
|
101
|
+
console.log("player key:" + key);
|
|
102
|
+
const audio = sAudioManager.createAudio(key);
|
|
103
|
+
//register listener
|
|
104
|
+
audio.addEventListener("ended", props.onEnded);
|
|
105
|
+
audio.addEventListener("error", props.onError);
|
|
106
|
+
audio.addEventListener("loadstart", props.onLoadStart);
|
|
107
|
+
audio.addEventListener("loadedmetadata", props.onLoadedMetaData);
|
|
108
|
+
audio.addEventListener("load", props.onLoad);
|
|
109
|
+
audio.addEventListener("audiofocusloss", props.onAudioFocusLoss);
|
|
110
|
+
audio.addEventListener("audiofocusgain", props.onAudioFocusGain);
|
|
111
|
+
// ste props
|
|
112
|
+
if (props.src && props.src !== "") {
|
|
113
|
+
audio.src = props.src;
|
|
114
|
+
}
|
|
113
115
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
116
|
+
if (props.autoplay) {
|
|
117
|
+
audio.autoplay = props.autoplay;
|
|
118
|
+
}
|
|
117
119
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
120
|
+
if (props.muted) {
|
|
121
|
+
audio.muted = props.muted;
|
|
122
|
+
}
|
|
121
123
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
this.onRef?.(this.audio);
|
|
126
|
-
},
|
|
124
|
+
if (props.loop) {
|
|
125
|
+
audio.loop = props.loop;
|
|
126
|
+
}
|
|
127
127
|
|
|
128
|
-
|
|
129
|
-
if (this.audio != null) {
|
|
130
|
-
this.audio.release();
|
|
131
|
-
this.onRef?.(null);
|
|
132
|
-
}
|
|
133
|
-
},
|
|
128
|
+
props.onRef?.(audio);
|
|
134
129
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
this.audio.addEventListener("loadedmetadata", this.onLoadedMetaData);
|
|
142
|
-
this.audio.addEventListener("load", this.onLoad);
|
|
143
|
-
this.audio.addEventListener("audiofocusloss", this.onAudioFocusLoss);
|
|
144
|
-
this.audio.addEventListener("audiofocusgain", this.onAudioFocusGain);
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
};
|
|
130
|
+
onBeforeUnmount(() => {
|
|
131
|
+
if (audio != null) {
|
|
132
|
+
audio.release();
|
|
133
|
+
props.onRef?.(null);
|
|
134
|
+
}
|
|
135
|
+
});
|
|
149
136
|
</script>
|
|
150
137
|
|
|
151
138
|
<template>
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
// import playerExMethods from "./JsvMediaBrowserInterface.js"
|
|
3
|
+
import JsvSystemAudio from '../../JsViewVueWidget/JsvSystemAudio.vue';
|
|
3
4
|
|
|
4
5
|
export default {
|
|
6
|
+
components: {
|
|
7
|
+
JsvSystemAudio,
|
|
8
|
+
},
|
|
5
9
|
props: {
|
|
6
10
|
onRef: { type: Function, default: () => {} },
|
|
7
11
|
},
|
|
@@ -11,8 +15,8 @@ export default {
|
|
|
11
15
|
};
|
|
12
16
|
},
|
|
13
17
|
methods: {
|
|
14
|
-
onRefProxy(
|
|
15
|
-
this.audioRef =
|
|
18
|
+
onRefProxy(audio_ref) {
|
|
19
|
+
this.audioRef = audio_ref;
|
|
16
20
|
|
|
17
21
|
// 不在此直接回调 onRef,因为onRefProxy可能会因为 .src的设置导致重新触发一次调用(vue本身问题)
|
|
18
22
|
// 参照vue-core处理的 componentUpdateFn处理, onMounted 一次, src设置后会再次 onPatch 一次
|
|
@@ -20,21 +24,21 @@ export default {
|
|
|
20
24
|
},
|
|
21
25
|
mounted() {
|
|
22
26
|
if (this.audioRef && this.onRef) {
|
|
23
|
-
let
|
|
27
|
+
let audio_ref = this.audioRef;
|
|
24
28
|
this.audioRef = null;
|
|
25
29
|
|
|
26
30
|
// 补充插件扩展出来的接口
|
|
27
31
|
// for (let method_name in playerExMethods) {
|
|
28
|
-
//
|
|
32
|
+
// audio_ref[method_name] = playerExMethods[method_name].bind(audio_ref);
|
|
29
33
|
// }
|
|
30
34
|
|
|
31
35
|
// 将修改好的video回调返回给使用者
|
|
32
|
-
this.onRef(
|
|
36
|
+
this.onRef(audio_ref);
|
|
33
37
|
}
|
|
34
38
|
},
|
|
35
39
|
beforeUnmount() {
|
|
36
40
|
if (this.onRef) {
|
|
37
|
-
//
|
|
41
|
+
// audio_ref为null,代表video标签卸载处理
|
|
38
42
|
this.onRef(null);
|
|
39
43
|
}
|
|
40
44
|
},
|
|
@@ -42,5 +46,5 @@ export default {
|
|
|
42
46
|
</script>
|
|
43
47
|
|
|
44
48
|
<template>
|
|
45
|
-
<audio :
|
|
49
|
+
<jsv-system-audio :onRef="onRefProxy" v-bind="$attrs" />
|
|
46
50
|
</template>
|