@shijiu/jsview-vue 2.2.35 → 2.2.128
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/bin/browser/BrowserApic.vue.mjs +2 -1
- package/bin/browser/BrowserApic2.vue.mjs +2 -1
- package/bin/browser/BrowserApicLib.mjs +2 -1
- package/bin/browser/BrowserQrcode.vue.mjs +3 -1
- package/bin/browser/BrowserTextureAnim.vue.mjs +7 -6
- package/bin/jsview-vue.mjs +1557 -894
- package/bin/types/JsViewEngineWidget/MetroWidget/Slide.d.ts +21 -0
- package/bin/types/JsViewEngineWidget/TemplateParser/MetroTemplate.d.ts +2 -8
- package/bin/types/JsViewEngineWidget/WidgetCommon.d.ts +9 -3
- package/bin/types/JsViewVueTools/ConstSymbol.d.ts +2 -0
- package/bin/types/JsViewVueTools/ForgeConstDefine.d.ts +11 -0
- package/bin/types/JsViewVueTools/JsvRuntimeBridge.d.ts +113 -57
- package/bin/types/JsViewVueTools/JsvTextureStore/CapturedTexture/CapturedTexture.d.ts +11 -0
- package/bin/types/JsViewVueTools/JsvTextureStore/Texture.d.ts +8 -0
- package/bin/types/JsViewVueWidget/JsvConnectLine/JsvConnectLine.vue.d.ts +1 -1
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/ActionRefObject.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/ActorControl.d.ts +65 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/ActorState.d.ts +6 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/CallbackManager.d.ts +11 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/ForgeTypeDefine.d.ts +15 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/FreeMoveActor.vue.d.ts +6 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/SetAction.d.ts +71 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/SetCondition.d.ts +95 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/SetState.d.ts +62 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/index.d.ts +2 -1
- package/bin/types/JsViewVueWidget/JsvLine/JsvLine.vue.d.ts +1 -1
- package/bin/types/JsViewVueWidget/JsvNativeSharedDiv.vue.d.ts +66 -28
- package/bin/types/JsViewVueWidget/JsvNinePatch.vue.d.ts +1 -0
- package/bin/types/JsViewVueWidget/JsvScrollBox/JsvScrollBox.vue.d.ts +176 -0
- package/bin/types/JsViewVueWidget/JsvScrollBox/ScrollSymbol.d.ts +7 -0
- package/bin/types/JsViewVueWidget/JsvScrollBox/index.d.ts +1 -0
- package/bin/types/JsViewVueWidget/JsvTextBox.vue.d.ts +3 -3
- package/bin/types/JsViewVueWidget/index.d.ts +1 -0
- package/package.json +1 -1
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +10 -1
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.js +398 -309
- package/utils/JsViewEngineWidget/MetroWidget/RenderItem.ts +2 -1
- package/utils/JsViewEngineWidget/MetroWidget/Slide.ts +56 -0
- package/utils/JsViewEngineWidget/MetroWidget/TaskManager.ts +51 -10
- package/utils/JsViewEngineWidget/MetroWidget/TokenGenerator.ts +10 -0
- package/utils/JsViewEngineWidget/TemplateParser/ListMetroTemplate.ts +9 -3
- package/utils/JsViewEngineWidget/TemplateParser/MetroTemplate.ts +25 -35
- package/utils/JsViewEngineWidget/WidgetCommon.ts +20 -7
- package/utils/JsViewPlugin/JsvPlayer/BrowserJsvPlayer.vue +13 -1
- package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +470 -338
- package/utils/JsViewVueTools/ConstSymbol.ts +3 -0
- package/utils/JsViewVueTools/ForgeConstDefine.ts +11 -0
- package/utils/JsViewVueTools/JsvRuntimeBridge.js +172 -50
- package/utils/JsViewVueTools/JsvTextureStore/CapturedTexture/CapturedTexture.ts +62 -0
- package/utils/JsViewVueTools/JsvTextureStore/JsvTextureStore.ts +41 -7
- package/utils/JsViewVueTools/JsvTextureStore/Texture.ts +15 -1
- package/utils/JsViewVueTools/index.js +2 -0
- package/utils/JsViewVueWidget/JsvApic/JsvApic/BrowserApic.vue +6 -6
- package/utils/JsViewVueWidget/JsvApic/JsvApic2/BrowserApic2.vue +5 -6
- package/utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/ApicDataBase.js +5 -1
- package/utils/JsViewVueWidget/JsvFreeMoveActor/ActionRefObject.ts +1 -1
- package/utils/JsViewVueWidget/JsvFreeMoveActor/ActorControl.ts +23 -1
- package/utils/JsViewVueWidget/JsvFreeMoveActor/ActorState.ts +4 -4
- package/utils/JsViewVueWidget/JsvFreeMoveActor/CallbackManager.ts +6 -6
- package/utils/JsViewVueWidget/JsvFreeMoveActor/ForgeTypeDefine.ts +1 -1
- package/utils/JsViewVueWidget/JsvFreeMoveActor/FreeMoveActor.vue +43 -9
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetAction.ts +24 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetCondition.ts +50 -1
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetState.ts +56 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/index.js +3 -0
- package/utils/JsViewVueWidget/JsvMaskClipDiv.vue +6 -1
- package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +121 -68
- package/utils/JsViewVueWidget/JsvNinePatch.vue +4 -1
- package/utils/JsViewVueWidget/JsvPosterImage.vue +22 -9
- package/utils/JsViewVueWidget/JsvQrcode/BrowserQrcode.vue +6 -2
- package/utils/JsViewVueWidget/JsvScrollBox/JsvScrollBox.vue +309 -0
- package/utils/JsViewVueWidget/JsvScrollBox/ScrollSymbol.ts +15 -0
- package/utils/JsViewVueWidget/JsvScrollBox/index.js +2 -0
- package/utils/JsViewVueWidget/JsvTextBox.vue +12 -4
- package/utils/JsViewVueWidget/JsvTextureAnim/BrowserTextureAnim.vue +9 -6
- package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +2 -0
- package/utils/JsViewVueWidget/index.js +1 -0
|
@@ -1,369 +1,501 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import {
|
|
3
|
+
JsvMediaVideo,
|
|
4
|
+
JsvMediaAudio,
|
|
5
|
+
findMediaObjectByKey,
|
|
6
|
+
logDebug,
|
|
7
|
+
} from "./JsvMedia";
|
|
8
|
+
import { JsvNativeSharedDiv } from "../../JsViewVueWidget";
|
|
5
9
|
|
|
6
10
|
export default {
|
|
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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
11
|
+
props: {
|
|
12
|
+
/**
|
|
13
|
+
* 回调函数,播放器对象通知接口
|
|
14
|
+
* @param {Object} video对象,可以通过此video对象调用video相关属性和方法,具体属性和方法定义见JsvMedia.js文件里相关说明。
|
|
15
|
+
*/
|
|
16
|
+
onRef: { type: Function, default: () => {} },
|
|
17
|
+
/**
|
|
18
|
+
* 属性,Boolean类型,true表示自动播放,默认false。
|
|
19
|
+
*/
|
|
20
|
+
autoplay: { type: Boolean, default: false },
|
|
21
|
+
/**
|
|
22
|
+
* 属性,String类型,播放器实例索引,同样的key使用同一个播放器实例。
|
|
23
|
+
*/
|
|
24
|
+
playerKey: { type: String, default: null },
|
|
25
|
+
/**
|
|
26
|
+
* 属性,String类型,播放器窗口模式,默认resizable模式。
|
|
27
|
+
* full:观影模式,全屏方式,不建议修改w/h/l/t,视频清晰度/流畅度最佳;
|
|
28
|
+
* resizable:可变窗口模式,可以随意修改w/h/l/t,支持动画效果,视频清晰度/流畅度表现可能不如full模式;
|
|
29
|
+
* pip:画中画模式,只在支持多路硬解的情况下使用,用户画中画的小窗播放,对清晰度/流畅度要求较差,可能会有反交错问题。
|
|
30
|
+
*/
|
|
31
|
+
windowMode: { type: String, default: "resizable" },
|
|
32
|
+
/**
|
|
33
|
+
* 属性,int类型,底层使用的播放器类型。1:系统播放器;2:jsv视频播放器;3:jsv音频播放器。默认2。
|
|
34
|
+
*/
|
|
35
|
+
playerType: { type: Number, default: 2 },
|
|
36
|
+
/**
|
|
37
|
+
* 属性,int类型,播放器解码方式。0:根据硬件能力自动匹配;1:硬解码;2:软解码。默认0(根据芯片能力自动匹配)。
|
|
38
|
+
*/
|
|
39
|
+
decodeType: { type: Number, default: 0 },
|
|
40
|
+
/**
|
|
41
|
+
* 属性,Boolean类型,层级关系,true表示在界面的下面,false表示在界面上面,默认true。
|
|
42
|
+
*/
|
|
43
|
+
background: { type: Boolean, default: true },
|
|
44
|
+
/**
|
|
45
|
+
* 属性,Boolean类型,true表示静音,默认false。
|
|
46
|
+
*/
|
|
47
|
+
muted: { type: Boolean, default: false },
|
|
48
|
+
/**
|
|
49
|
+
* 属性,Boolean类型,true表示循环播放,默认false。
|
|
50
|
+
*/
|
|
51
|
+
loop: { type: Boolean, default: false },
|
|
52
|
+
/**
|
|
53
|
+
* 属性,String类型,播放地址。
|
|
54
|
+
*/
|
|
55
|
+
src: { type: String, default: "" },
|
|
56
|
+
/**
|
|
57
|
+
* 属性,Double类型,起播时间,0-duration。
|
|
58
|
+
*/
|
|
59
|
+
currentTime: { type: Number, default: 0 },
|
|
60
|
+
/**
|
|
61
|
+
* 属性,Boolean类型,是否保留最后一帧,true保留,false不保留。
|
|
62
|
+
*/
|
|
63
|
+
keepLastFrame: { type: Boolean, default: true },
|
|
64
|
+
/**
|
|
65
|
+
* 属性,String类型,视频显示比例,origin原始比例显示,full全屏显示,x:y按照指定比例显示。
|
|
66
|
+
*/
|
|
67
|
+
videoAspectRatio: { type: String, default: "origin" },
|
|
68
|
+
/**
|
|
69
|
+
* 属性,JSON Object类型,色度抠像参数,包含color,colorDistance,edgeDistance,greenOffset四个参数,
|
|
70
|
+
* 参考格式:{color: 0x30FF30, colorDistance: 0.15, edgeDistance: 0.4, greenOffset: 0.05}
|
|
71
|
+
* color,色值,int类型,为抠图色值范围的中心点,格式为0xRRGGBB。
|
|
72
|
+
* colorDistance,float类型,色域范围,范围0-1.0。
|
|
73
|
+
* edgeDistance,float类型,alpha透明度距离,范围colorDistance-1.0,从colorDistance到edgeDistance的alpha值从1.0-0线性递减。
|
|
74
|
+
* greenOffset,float类型,红蓝差值,范围0-1.0。
|
|
75
|
+
* 目前只支持扣绿。
|
|
76
|
+
*/
|
|
77
|
+
chromaKey: { type: Object, default: null },
|
|
78
|
+
/**
|
|
79
|
+
* 回调函数,播放结束时通过此回调接口通知。
|
|
80
|
+
*/
|
|
81
|
+
onEnded: {
|
|
82
|
+
type: Function,
|
|
83
|
+
default: () => {
|
|
84
|
+
return {};
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
/**
|
|
88
|
+
* 回调函数,播放错误时通过此接口通知。
|
|
89
|
+
* @param {int} 错误类型,当前定义了四种错误。1是异常中断;2是网络错误;3是解码错误;4是格式不支持。
|
|
90
|
+
*/
|
|
91
|
+
onError: {
|
|
92
|
+
type: Function,
|
|
93
|
+
default: () => {
|
|
94
|
+
return {};
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
// onAbort: {type: Function, default: ()=>{return{}}},
|
|
98
|
+
/**
|
|
99
|
+
* 回调函数,当正常播放时,每0.5秒上报一次,回调接口里会带上当前时间,也可以使用video对象的currentTime属性去获取当前时间。
|
|
100
|
+
* @param {Long} 当前播放时间,单位秒。
|
|
101
|
+
*/
|
|
102
|
+
onTimeUpdate: {
|
|
103
|
+
type: Function,
|
|
104
|
+
default: () => {
|
|
105
|
+
return {};
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
/**
|
|
109
|
+
* 回调函数,开始加载,设置完播放地址后,上报此事件。
|
|
110
|
+
*/
|
|
111
|
+
onLoadStart: {
|
|
112
|
+
type: Function,
|
|
113
|
+
default: () => {
|
|
114
|
+
return {};
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
/**
|
|
118
|
+
* 回调函数,开始正常播放,同一个播放地址仅触发一次。
|
|
119
|
+
*/
|
|
120
|
+
onCanPlayThrough: {
|
|
121
|
+
type: Function,
|
|
122
|
+
default: () => {
|
|
123
|
+
return {};
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
/**
|
|
127
|
+
* 回调函数,正常下载,duration不变的情况下只触发一次。
|
|
128
|
+
*/
|
|
129
|
+
onProgress: {
|
|
130
|
+
type: Function,
|
|
131
|
+
default: () => {
|
|
132
|
+
return {};
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
/**
|
|
136
|
+
* 回调函数,视频准备好后触发。
|
|
137
|
+
*/
|
|
138
|
+
onLoadedMetaData: {
|
|
139
|
+
type: Function,
|
|
140
|
+
default: () => {
|
|
141
|
+
return {};
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
/**
|
|
145
|
+
* 回调函数,视频准备好后触发,这个时候可以正常seek。
|
|
146
|
+
*/
|
|
147
|
+
onLoad: {
|
|
148
|
+
type: Function,
|
|
149
|
+
default: () => {
|
|
150
|
+
return {};
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
/**
|
|
154
|
+
* 回调函数,视频准备好后触发,这个时候可以获取duration。
|
|
155
|
+
*/
|
|
156
|
+
onDurationChange: {
|
|
157
|
+
type: Function,
|
|
158
|
+
default: () => {
|
|
159
|
+
return {};
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
/**
|
|
163
|
+
* 回调函数,视频准备好后,seek(修改currentTime)会出发此事件。
|
|
164
|
+
*/
|
|
165
|
+
onSeeking: {
|
|
166
|
+
type: Function,
|
|
167
|
+
default: () => {
|
|
168
|
+
return {};
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
/**
|
|
172
|
+
* 回调函数,seek完成后触发此事件。
|
|
173
|
+
*/
|
|
174
|
+
onSeeked: {
|
|
175
|
+
type: Function,
|
|
176
|
+
default: () => {
|
|
177
|
+
return {};
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
/**
|
|
181
|
+
* 回调函数,缓冲时触发。
|
|
182
|
+
*/
|
|
183
|
+
onStalled: {
|
|
184
|
+
type: Function,
|
|
185
|
+
default: () => {
|
|
186
|
+
return {};
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
/**
|
|
190
|
+
* 回调函数,正常播放后触发。
|
|
191
|
+
*/
|
|
192
|
+
onPlaying: {
|
|
193
|
+
type: Function,
|
|
194
|
+
default: () => {
|
|
195
|
+
return {};
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
/**
|
|
199
|
+
* 回调函数,正常显示后触发此事件。
|
|
200
|
+
*/
|
|
201
|
+
onCanPlay: {
|
|
202
|
+
type: Function,
|
|
203
|
+
default: () => {
|
|
204
|
+
return {};
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
/**
|
|
208
|
+
* 回调函数,音频失去焦点后触发此事件,可能会导致pause(点播)或者离开频道(直播)。
|
|
209
|
+
*/
|
|
210
|
+
onAudioFocusLoss: {
|
|
211
|
+
type: Function,
|
|
212
|
+
default: () => {
|
|
213
|
+
return {};
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
/**
|
|
217
|
+
* 回调函数,音频获取焦点后触发此事件,可能会触发resume(点播)或者加入频道(直播)。
|
|
218
|
+
*/
|
|
219
|
+
onAudioFocusGain: {
|
|
220
|
+
type: Function,
|
|
221
|
+
default: () => {
|
|
222
|
+
return {};
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
/**
|
|
226
|
+
* 回调函数,直播进入时移状态时,触发此事件。
|
|
227
|
+
*/
|
|
228
|
+
onTimeShift: {
|
|
229
|
+
type: Function,
|
|
230
|
+
default: () => {
|
|
231
|
+
return {};
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
/**
|
|
235
|
+
* 回调函数,直播进入时移状态时,成功播放触发此事件。
|
|
236
|
+
*/
|
|
237
|
+
onTimeShifted: {
|
|
238
|
+
type: Function,
|
|
239
|
+
default: () => {
|
|
240
|
+
return {};
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
/**
|
|
244
|
+
* 回调函数,时移回到直播状态,触发此事件。
|
|
245
|
+
*/
|
|
246
|
+
onBackLive: {
|
|
247
|
+
type: Function,
|
|
248
|
+
default: () => {
|
|
249
|
+
return {};
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
/**
|
|
253
|
+
* 回调函数,时移回到直播状态时,成功播放触发此事件。
|
|
254
|
+
*/
|
|
255
|
+
onBackLived: {
|
|
256
|
+
type: Function,
|
|
257
|
+
default: () => {
|
|
258
|
+
return {};
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
/**
|
|
262
|
+
* 属性,Object类型,设置窗口属性,同其他组件的style设置。
|
|
263
|
+
*/
|
|
264
|
+
style: {
|
|
265
|
+
type: Object,
|
|
266
|
+
default: () => {
|
|
267
|
+
return {};
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
/**
|
|
271
|
+
* 属性,Boolean类型,活跃状态,当多个JsvPlayer组件指向一个video对象时,只能有一个处于活跃状态。
|
|
272
|
+
* 视频显示在活跃JsvPlayer设置的显示区域内,事件通知也只会送给活跃的JsvPlayer组件注册的回调函数。
|
|
273
|
+
*/
|
|
274
|
+
active: { type: Boolean, default: true },
|
|
275
|
+
corner: { type: Number, default: 0 },
|
|
276
|
+
},
|
|
277
|
+
components: {
|
|
278
|
+
JsvNativeSharedDiv,
|
|
279
|
+
},
|
|
280
|
+
watch: {
|
|
281
|
+
active(newValue) {
|
|
282
|
+
logDebug("active newValue: " + newValue);
|
|
283
|
+
if (this.video && this.playerType !== 3) {
|
|
284
|
+
if (newValue) {
|
|
285
|
+
this.registerEvent();
|
|
286
|
+
this.video.setHoleID(this.holeId);
|
|
287
|
+
this.holeStyle = {
|
|
288
|
+
left: 0,
|
|
289
|
+
top: 0,
|
|
290
|
+
width: this.style.width,
|
|
291
|
+
height: this.style.height,
|
|
292
|
+
};
|
|
293
|
+
} else {
|
|
294
|
+
this.holeStyle = {
|
|
295
|
+
left: 0,
|
|
296
|
+
top: 0,
|
|
297
|
+
width: 0,
|
|
298
|
+
height: 0,
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
style(newValue) {
|
|
304
|
+
logDebug(
|
|
305
|
+
"holeStyle newValue: left=" +
|
|
306
|
+
newValue.left +
|
|
307
|
+
", top=" +
|
|
308
|
+
newValue.top +
|
|
309
|
+
", width=" +
|
|
310
|
+
newValue.width +
|
|
311
|
+
", height=" +
|
|
312
|
+
newValue.height
|
|
313
|
+
);
|
|
314
|
+
if (this.active && this.playerType !== 3) {
|
|
315
|
+
this.holeStyle = {
|
|
316
|
+
left: 0,
|
|
317
|
+
top: 0,
|
|
318
|
+
width: newValue.width,
|
|
319
|
+
height: newValue.height,
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
keepLastFrame(newValue) {
|
|
324
|
+
logDebug("keepLastFrame newValue: " + newValue);
|
|
325
|
+
if (this.video && this.active) {
|
|
326
|
+
this.video.keepLastFrame = this.keepLastFrame;
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
},
|
|
330
|
+
|
|
331
|
+
setup() {
|
|
332
|
+
return {
|
|
333
|
+
video: null,
|
|
334
|
+
holeId: "",
|
|
335
|
+
};
|
|
336
|
+
},
|
|
205
337
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
338
|
+
data() {
|
|
339
|
+
return {
|
|
340
|
+
holeStyle: {},
|
|
341
|
+
};
|
|
342
|
+
},
|
|
343
|
+
created() {},
|
|
344
|
+
mounted() {
|
|
345
|
+
logDebug("JsvPlayer:", this.style);
|
|
212
346
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
created() {
|
|
219
|
-
},
|
|
220
|
-
mounted() {
|
|
221
|
-
logDebug("JsvPlayer:",this.style)
|
|
222
|
-
|
|
223
|
-
let key = "Jsv_" + Math.floor(Math.random() * 10000);
|
|
224
|
-
if(this.playerKey){
|
|
225
|
-
key = this.playerKey;
|
|
226
|
-
}
|
|
227
|
-
logDebug("player key:"+key)
|
|
347
|
+
let key = "Jsv_" + Math.floor(Math.random() * 10000);
|
|
348
|
+
if (this.playerKey) {
|
|
349
|
+
key = this.playerKey;
|
|
350
|
+
}
|
|
351
|
+
logDebug("player key:" + key);
|
|
228
352
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
player_type = this.playerType;
|
|
353
|
+
let player_type = 2;
|
|
354
|
+
if (this.playerType) player_type = this.playerType;
|
|
232
355
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
background = this.background;
|
|
356
|
+
let background = true;
|
|
357
|
+
if (!this.background) background = this.background;
|
|
236
358
|
|
|
237
|
-
|
|
359
|
+
logDebug("JsvPlayer background:" + background);
|
|
238
360
|
|
|
239
|
-
|
|
240
|
-
|
|
361
|
+
const designMap = window.Forge.DesignMap();
|
|
362
|
+
logDebug("JsvPlayer:", this.holeId);
|
|
241
363
|
|
|
242
|
-
|
|
243
|
-
|
|
364
|
+
this.video = findMediaObjectByKey(key);
|
|
365
|
+
let first_create = true;
|
|
244
366
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
367
|
+
if (!this.video) {
|
|
368
|
+
if (player_type === 3) {
|
|
369
|
+
this.video = new JsvMediaAudio(key, designMap.width);
|
|
370
|
+
} else {
|
|
371
|
+
this.video = new JsvMediaVideo(
|
|
372
|
+
this.holeId,
|
|
373
|
+
this.windowMode,
|
|
374
|
+
player_type,
|
|
375
|
+
key,
|
|
376
|
+
background,
|
|
377
|
+
designMap.width,
|
|
378
|
+
this.decodeType
|
|
379
|
+
);
|
|
380
|
+
}
|
|
381
|
+
} else {
|
|
382
|
+
this.video.setRef();
|
|
383
|
+
first_create = false;
|
|
384
|
+
}
|
|
255
385
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
386
|
+
if (this.video != null) {
|
|
387
|
+
if (this.active) {
|
|
388
|
+
this.registerEvent();
|
|
259
389
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
this.video.src = this.src;
|
|
263
|
-
|
|
264
|
-
if(this.currentTime !== 0)
|
|
265
|
-
this.video.currentTime = this.currentTime;
|
|
390
|
+
//if(first_create){
|
|
391
|
+
if (this.src && this.src !== "") this.video.src = this.src;
|
|
266
392
|
|
|
267
|
-
|
|
268
|
-
this.video.autoplay = this.autoplay;
|
|
269
|
-
}
|
|
393
|
+
if (this.currentTime !== 0) this.video.currentTime = this.currentTime;
|
|
270
394
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
395
|
+
if (this.autoplay) {
|
|
396
|
+
this.video.autoplay = this.autoplay;
|
|
397
|
+
}
|
|
274
398
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
399
|
+
if (this.muted) {
|
|
400
|
+
this.video.muted = this.muted;
|
|
401
|
+
}
|
|
278
402
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
403
|
+
if (this.loop) {
|
|
404
|
+
this.video.loop = this.loop;
|
|
405
|
+
}
|
|
282
406
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
407
|
+
if (!this.keepLastFrame) {
|
|
408
|
+
this.video.keepLastFrame = this.keepLastFrame;
|
|
409
|
+
}
|
|
286
410
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
//}else{
|
|
291
|
-
if(!first_create){
|
|
292
|
-
this.video.setHoleID(this.holeId);
|
|
293
|
-
if(this.playerType !== 3){
|
|
294
|
-
this.holeStyle = {
|
|
295
|
-
left: 0, top: 0,
|
|
296
|
-
width: this.style.width, height: this.style.height
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
}
|
|
411
|
+
if (this.videoAspectRatio !== "origin") {
|
|
412
|
+
this.video.videoAspectRatio = this.videoAspectRatio;
|
|
413
|
+
}
|
|
301
414
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
415
|
+
if (this.chromaKey && this.chromaKey !== "") {
|
|
416
|
+
this.video.setChromaKey(this.chromaKey);
|
|
417
|
+
}
|
|
418
|
+
//}else{
|
|
419
|
+
if (!first_create) {
|
|
420
|
+
this.video.setHoleID(this.holeId);
|
|
421
|
+
if (this.playerType !== 3) {
|
|
422
|
+
this.holeStyle = {
|
|
423
|
+
left: 0,
|
|
424
|
+
top: 0,
|
|
425
|
+
width: this.style.width,
|
|
426
|
+
height: this.style.height,
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}
|
|
305
431
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
432
|
+
this.onRef?.(this.video);
|
|
433
|
+
}
|
|
434
|
+
},
|
|
309
435
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
436
|
+
unmounted() {
|
|
437
|
+
if (this.video != null) {
|
|
438
|
+
this.video.releasePlayer();
|
|
313
439
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
440
|
+
this.onRef?.(null);
|
|
441
|
+
}
|
|
442
|
+
},
|
|
443
|
+
|
|
444
|
+
methods: {
|
|
445
|
+
getHoleId(id) {
|
|
446
|
+
logDebug("getHoleId:", id);
|
|
447
|
+
this.holeId = id;
|
|
448
|
+
},
|
|
449
|
+
registerEvent() {
|
|
450
|
+
if (this.video && this.active) {
|
|
451
|
+
this.video.addEventListener("end", this.onEnded);
|
|
452
|
+
this.video.addEventListener("error", this.onError);
|
|
453
|
+
//this.video.addEventListener("abort", this.onAbort);
|
|
454
|
+
this.video.addEventListener("timeupdate", this.onTimeUpdate);
|
|
455
|
+
this.video.addEventListener("loadstart", () => {
|
|
456
|
+
logDebug("JsvPlayer received loadstart event.");
|
|
457
|
+
if (this.playerType !== 3) {
|
|
458
|
+
this.holeStyle = {
|
|
459
|
+
left: 0,
|
|
460
|
+
top: 0,
|
|
461
|
+
width: this.style.width,
|
|
462
|
+
height: this.style.height,
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
this.onLoadStart();
|
|
466
|
+
});
|
|
467
|
+
this.video.addEventListener("canplaythrough", this.onCanPlayThrough);
|
|
468
|
+
this.video.addEventListener("progress", this.onProgress);
|
|
469
|
+
this.video.addEventListener("loadedmetadata", this.onLoadedMetaData);
|
|
470
|
+
this.video.addEventListener("load", this.onLoad);
|
|
471
|
+
this.video.addEventListener("durationchange", this.onDurationChange);
|
|
472
|
+
this.video.addEventListener("seeking", this.onSeeking);
|
|
473
|
+
this.video.addEventListener("seeked", this.onSeeked);
|
|
474
|
+
this.video.addEventListener("stalled", this.onStalled);
|
|
475
|
+
this.video.addEventListener("playing", this.onPlaying);
|
|
476
|
+
this.video.addEventListener("canplay", this.onCanPlay);
|
|
477
|
+
this.video.addEventListener("audiofocusloss", this.onAudioFocusLoss);
|
|
478
|
+
this.video.addEventListener("audiofocusgain", this.onAudioFocusGain);
|
|
479
|
+
this.video.addEventListener("timeshift", this.onTimeShift);
|
|
480
|
+
this.video.addEventListener("timeshifted", this.onTimeShifted);
|
|
481
|
+
this.video.addEventListener("backlive", this.onBackLive);
|
|
482
|
+
this.video.addEventListener("backlived", this.onBackLived);
|
|
483
|
+
}
|
|
484
|
+
},
|
|
485
|
+
},
|
|
486
|
+
};
|
|
355
487
|
|
|
356
488
|
//export default JsvPlayer;
|
|
357
489
|
</script>
|
|
358
490
|
|
|
359
491
|
<template>
|
|
360
|
-
<div
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
492
|
+
<div v-if="playerType != 3" :style="style" backgroundColor="rgba(0,0,0,1)">
|
|
493
|
+
<JsvNativeSharedDiv
|
|
494
|
+
:style="holeStyle"
|
|
495
|
+
:getId="getHoleId"
|
|
496
|
+
:corner="corner"
|
|
497
|
+
></JsvNativeSharedDiv>
|
|
364
498
|
</div>
|
|
365
499
|
</template>
|
|
366
500
|
|
|
367
|
-
<style scoped>
|
|
368
|
-
|
|
369
|
-
</style>
|
|
501
|
+
<style scoped></style>
|