@shijiu/jsview-vue 0.9.426 → 0.9.502
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/dom/bin/jsview-browser-debug-dom.min.js +1 -1
- package/dom/bin/jsview-dom.min.js +1 -1
- package/dom/jsv-browser-debug-dom.js_1 +8 -0
- package/dom/jsv-dom.js_1 +6 -0
- package/dom/jsv-forge-define.js_1 +6 -0
- package/dom/target_core_revision.js +3 -3
- package/package.json +1 -1
- package/patches/node_modules/@vue/cli-service/lib/config/assets.js +1 -1
- package/patches/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js +4 -1
- package/samples/ColorSpace/App.vue +4 -4
- package/samples/DemoHomepage/router.js +17 -2
- package/samples/FilterDemo/App.vue +121 -0
- package/samples/GridDemo/App.vue +183 -0
- package/samples/GridDemo/ButtonBlock.vue +111 -0
- package/samples/GridDemo/FocusItem.vue +56 -0
- package/samples/GridDemo/Item.vue +101 -0
- package/samples/NinePatchDemo/App.vue +146 -0
- package/samples/NinePatchDemo/Item.vue +70 -0
- package/samples/NinePatchDemo/assets/border.png +0 -0
- package/samples/TouchSample/App.vue +137 -0
- package/samples/TouchSample/Item.vue +101 -0
- package/samples/TouchSample/MetroWidgetHorizontal.vue +144 -0
- package/samples/TouchSample/MetroWidgetVertical.vue +144 -0
- package/samples/TouchSample/TouchContainerHorizontal.vue +159 -0
- package/samples/TouchSample/TouchContainerVertical.vue +159 -0
- package/samples/TouchSample/data.js +81 -0
- package/samples/{ColorSpace → assets}/bmpDemo.bmp +0 -0
- package/samples/{ColorSpace → assets}/jpegDemo.jpeg +0 -0
- package/samples/{ColorSpace → assets}/pngDemo.png +0 -0
- package/samples/{ColorSpace → assets}/pngNoAlphaDemo.png +0 -0
- package/samples/assets/webpDemo.webp +0 -0
- package/scripts/jsview-jsmap-serve.js +63 -0
- package/scripts/jsview-post-build.js +50 -3
- package/scripts/jsview-post-install.js +22 -0
- package/utils/JsViewEngineWidget/JsvFocusBlock.vue +7 -5
- package/utils/JsViewEngineWidget/JsvFocusManager.js +5 -0
- package/utils/JsViewEngineWidget/MetroWidget/ItemView.vue +7 -14
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +214 -89
- package/utils/JsViewEngineWidget/MetroWidget/RootView.vue +4 -3
- package/utils/JsViewEngineWidget/SimpleWidget/SimpleWidget.vue +2 -0
- package/utils/JsViewEngineWidget/TemplateParser.js +8 -6
- package/utils/JsViewPlugin/JsvPlayer/GetVersion.js +20 -0
- package/utils/JsViewPlugin/JsvPlayer/JsvMedia.js +220 -85
- package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +43 -14
- package/utils/JsViewPlugin/JsvPlayer/JsvPlayerBrowser.vue +25 -12
- package/utils/JsViewPlugin/JsvPlayer/index.js +4 -0
- package/utils/JsViewPlugin/JsvPlayer/version.js +19 -0
- package/utils/JsViewVueTools/DebugTool.js +24 -0
- package/utils/JsViewVueTools/NinePatchHelper.js +44 -0
- package/utils/JsViewVueTools/TypeCheckAndSet.js +27 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserQrcode.vue +19 -8
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/BrowserApic.vue +1 -1
- package/utils/JsViewVueWidget/JsvApic/JsvApic.vue +2 -2
- package/utils/JsViewVueWidget/JsvFilterView.vue +73 -0
- package/utils/JsViewVueWidget/JsvGrid.vue +573 -0
- package/utils/JsViewVueWidget/JsvInput/JsvInput.vue +7 -0
- package/utils/JsViewVueWidget/JsvNinePatch.vue +2 -2
- package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +12 -3
- package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +1 -1
- package/utils/JsViewVueWidget/JsvTextureAnim/CommonType.js +8 -0
- package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +171 -38
- package/utils/JsViewVueWidget/JsvTextureAnim/index.js +3 -2
- package/utils/JsViewVueWidget/JsvTouchContainer.vue +184 -0
|
@@ -1,34 +1,49 @@
|
|
|
1
1
|
/* eslint-disable no-prototype-builtins */
|
|
2
|
+
import {getPluginInfo} from './GetVersion'
|
|
2
3
|
|
|
3
|
-
let MediaPluginInfo=
|
|
4
|
-
//downloadUrl:"http://192.168.0.37:8080/plugin/JsvPlayer-6.0.zip", //插件下载地址
|
|
5
|
-
packageName:"com.qcode.jsvplayer",
|
|
6
|
-
name:"播放器插件",
|
|
7
|
-
version:"1.3.7", //插件需要的版本号
|
|
8
|
-
versionCodeMin:137,
|
|
9
|
-
versionCodeMax:137,
|
|
10
|
-
bridgeName:"jsvPlayerBridge", //插件bridge注册到jsview的名称
|
|
11
|
-
className:"com.qcode.jsvplayer.JsvPlayer", //插件初始化类名称
|
|
12
|
-
initMethod:"createInstance", //插件初始化方法
|
|
13
|
-
listener:"top.JsvPlayerPluginLoadResult", //插件加载结果回调
|
|
14
|
-
listener2: "top.JsvPlayerPluginStatus",
|
|
15
|
-
// debug:true,
|
|
16
|
-
// md5:"9fca9d2dc29468d332961b0be3e8081e"
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
function reconfigMediaPluginInfo(){
|
|
20
|
-
if(typeof window.jJsvRuntimeBridge!=='undefined' && window.jJsvRuntimeBridge && typeof window.jJsvRuntimeBridge.getPluginBaseUrl !== "undefined"){
|
|
21
|
-
let plugin_base_url = window.jJsvRuntimeBridge.getPluginBaseUrl();
|
|
22
|
-
if(plugin_base_url){
|
|
23
|
-
MediaPluginInfo.downloadUrl = (plugin_base_url[plugin_base_url.length-1]==="/"?plugin_base_url:(plugin_base_url+"/"))+MediaPluginInfo.packageName+"/JsvPlayer-137.zip?md5=14aff2c55c94c1963d76b617504576c9";
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
4
|
+
let MediaPluginInfo = getPluginInfo();
|
|
27
5
|
|
|
28
6
|
var mediaArray = [];
|
|
29
7
|
|
|
30
8
|
var pluginLoadListener = [];
|
|
31
9
|
|
|
10
|
+
let LOG_LEVEL_FATAL = 5;
|
|
11
|
+
let LOG_LEVEL_ERROR = 4;
|
|
12
|
+
let LOG_LEVEL_WARNING = 3;
|
|
13
|
+
let LOG_LEVEL_DEBUG = 2;
|
|
14
|
+
let LOG_LEVEL_TRACE = 1;
|
|
15
|
+
let LogLevel = LOG_LEVEL_TRACE;
|
|
16
|
+
function logPrint(level, message){
|
|
17
|
+
if(level >= LogLevel){
|
|
18
|
+
console.log(message);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function logFatal(message){
|
|
23
|
+
logPrint(LOG_LEVEL_FATAL, message);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function logError(message){
|
|
27
|
+
logPrint(LOG_LEVEL_ERROR, message);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function logWarning(message){
|
|
31
|
+
logPrint(LOG_LEVEL_WARNING, message);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function logDebug(message){
|
|
35
|
+
logPrint(LOG_LEVEL_DEBUG, message);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function logTrace(message){
|
|
39
|
+
logPrint(LOG_LEVEL_TRACE, message);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function setLogLevel(level){
|
|
43
|
+
LogLevel = level;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
32
47
|
/**
|
|
33
48
|
* 0:未加载;
|
|
34
49
|
* 1:开始加载;
|
|
@@ -40,7 +55,7 @@ var pluginLoadListener = [];
|
|
|
40
55
|
var pluginLoadState = 0;
|
|
41
56
|
|
|
42
57
|
window.top.JsvPlayerPluginStatus = function(status){
|
|
43
|
-
|
|
58
|
+
logDebug("JsvPlayerPluginStatus: "+status);
|
|
44
59
|
let ret = JSON.parse(status);
|
|
45
60
|
|
|
46
61
|
let plugin_status = 2;
|
|
@@ -57,7 +72,7 @@ window.top.JsvPlayerPluginStatus = function(status){
|
|
|
57
72
|
}
|
|
58
73
|
|
|
59
74
|
window.top.JsvPlayerPluginLoadResult = function (result) {
|
|
60
|
-
|
|
75
|
+
logDebug("JsvPlayerPluginLoadResult: "+result);
|
|
61
76
|
var ret_obj = JSON.parse(result)
|
|
62
77
|
let plugin_status = 1;
|
|
63
78
|
if(ret_obj && (ret_obj.status === 4 || ret_obj.status === 1)){
|
|
@@ -69,6 +84,10 @@ window.top.JsvPlayerPluginLoadResult = function (result) {
|
|
|
69
84
|
}else{
|
|
70
85
|
pluginLoadState = 5;
|
|
71
86
|
}
|
|
87
|
+
|
|
88
|
+
if(pluginLoadState === 5){
|
|
89
|
+
logFatal("*************************JsvPlayer plugin load failed, error code is "+ret_obj.status+"*************************");
|
|
90
|
+
}
|
|
72
91
|
|
|
73
92
|
for(let i=0; i<mediaArray.length; i++){
|
|
74
93
|
mediaArray[i].buildPlatformInstance();
|
|
@@ -80,7 +99,7 @@ window.top.JsvPlayerPluginLoadResult = function (result) {
|
|
|
80
99
|
}
|
|
81
100
|
|
|
82
101
|
window.top.CreatePlayerResult = function (result) {
|
|
83
|
-
|
|
102
|
+
logDebug("CreatePlayerResult: "+result);
|
|
84
103
|
let result_obj = JSON.parse(result);
|
|
85
104
|
if(result_obj.code == 0){
|
|
86
105
|
for(var i=0; i<mediaArray.length; i++){
|
|
@@ -90,7 +109,7 @@ window.top.CreatePlayerResult = function (result) {
|
|
|
90
109
|
}
|
|
91
110
|
}
|
|
92
111
|
}else{
|
|
93
|
-
|
|
112
|
+
logError("Create player failed, key="+result_obj.key);
|
|
94
113
|
}
|
|
95
114
|
}.bind(this);
|
|
96
115
|
|
|
@@ -107,7 +126,7 @@ window.top.CreatePlayerResult = function (result) {
|
|
|
107
126
|
* 备注:不管插件加载处于什么状态,都可以正常使用播放器组件,播放器对象在插件未加载完成的情况下,会把相关状态保存,等完成加载后再自动下发。
|
|
108
127
|
*/
|
|
109
128
|
function globalLoadJsvPlayerPlugin(listener){
|
|
110
|
-
|
|
129
|
+
logDebug("globalLoadJsvPlayerPlugin");
|
|
111
130
|
let plugin_status = 0;
|
|
112
131
|
if(typeof window.jPluginManagerBridge==='undefined' || !window.jPluginManagerBridge){
|
|
113
132
|
plugin_status = 1;
|
|
@@ -137,8 +156,6 @@ function globalLoadJsvPlayerPlugin(listener){
|
|
|
137
156
|
}
|
|
138
157
|
pluginLoadState = 1;
|
|
139
158
|
|
|
140
|
-
reconfigMediaPluginInfo();
|
|
141
|
-
|
|
142
159
|
window.jPluginManagerBridge.LoadPlugin(JSON.stringify(MediaPluginInfo));
|
|
143
160
|
}
|
|
144
161
|
|
|
@@ -159,6 +176,8 @@ function findMediaObjectByKey(key){
|
|
|
159
176
|
|
|
160
177
|
class JsvBaseMedia {
|
|
161
178
|
constructor(type, hole_id, player_type, key, background, design_map_width) {
|
|
179
|
+
logTrace("Create JsvBaseMedia, type="+type+", hole_id="+hole_id+", player_type="+player_type+", key="+key+", background="+background+", design_map_width="+design_map_width);
|
|
180
|
+
|
|
162
181
|
this.state = {
|
|
163
182
|
muted: false,
|
|
164
183
|
paused: true,
|
|
@@ -168,7 +187,10 @@ class JsvBaseMedia {
|
|
|
168
187
|
startTime: 0.0,
|
|
169
188
|
currentTime: 0.0,
|
|
170
189
|
aspectRatio: "origin",
|
|
171
|
-
keepLastFrame:
|
|
190
|
+
keepLastFrame: true,
|
|
191
|
+
timeUpdateLess: false,
|
|
192
|
+
rate: 1.0,
|
|
193
|
+
volume: 1.0,
|
|
172
194
|
};
|
|
173
195
|
|
|
174
196
|
this.local = {
|
|
@@ -176,6 +198,7 @@ class JsvBaseMedia {
|
|
|
176
198
|
playableDuration: 0.0,
|
|
177
199
|
duration: 0.0,
|
|
178
200
|
isRenderable: false,
|
|
201
|
+
paused: true,
|
|
179
202
|
};
|
|
180
203
|
|
|
181
204
|
this.type = type;
|
|
@@ -188,7 +211,9 @@ class JsvBaseMedia {
|
|
|
188
211
|
this.designMapWidth = design_map_width;
|
|
189
212
|
this.channelID = -1;
|
|
190
213
|
this.ref = 1;
|
|
214
|
+
this.appVisible = window.JsView&&window.JsView.getVisibility?(window.JsView.getVisibility()==="show"):true;
|
|
191
215
|
this._onEvent = this.onEvent.bind(this);
|
|
216
|
+
this._onVisibilityChangeCallBack = this.onVisibilityChangeCallBack.bind(this);
|
|
192
217
|
|
|
193
218
|
let found = false;
|
|
194
219
|
for(let i=0; i<mediaArray.length; i++){
|
|
@@ -213,8 +238,10 @@ class JsvBaseMedia {
|
|
|
213
238
|
* 私有接口,外部不需要调用此接口。
|
|
214
239
|
*/
|
|
215
240
|
buildPlatformInstance() {
|
|
241
|
+
logTrace("buildPlatformInstance, key="+this.key);
|
|
242
|
+
|
|
216
243
|
if(typeof window.jsvPlayerBridge=='undefined' || !window.jsvPlayerBridge){
|
|
217
|
-
|
|
244
|
+
logError("no jsvPlayerBridge");
|
|
218
245
|
return;
|
|
219
246
|
}
|
|
220
247
|
|
|
@@ -233,27 +260,40 @@ class JsvBaseMedia {
|
|
|
233
260
|
if(this.playerCreate)
|
|
234
261
|
return;
|
|
235
262
|
|
|
263
|
+
logDebug("InitPlayer:1, key="+this.key);
|
|
264
|
+
|
|
236
265
|
this.playerCreate = true;
|
|
237
266
|
|
|
238
267
|
window.JMD.subscribe(this.key, this._onEvent);
|
|
268
|
+
if (window.JsView && window.JsView.onVisibilityChange) {
|
|
269
|
+
logDebug("playerKey: "+this.key+", onVisibilityChange register");
|
|
270
|
+
window.JsView.onVisibilityChange(this._onVisibilityChangeCallBack);
|
|
271
|
+
}
|
|
239
272
|
|
|
240
|
-
console.log("InitPlayer:1");
|
|
241
273
|
if(this.holeIdModify !== this.holeId){
|
|
242
274
|
window.jsvPlayerBridge.setHoleID(this.key, this.holeIdModify);
|
|
243
275
|
this.holeId = this.holeIdModify;
|
|
244
276
|
}
|
|
245
277
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
this.
|
|
278
|
+
this.appVisible = window.JsView&&window.JsView.getVisibility?(window.JsView.getVisibility()==="show"):true;
|
|
279
|
+
|
|
280
|
+
if(this.appVisible){
|
|
281
|
+
this.initParams();
|
|
250
282
|
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
initParams(){
|
|
286
|
+
logDebug("InitPlayer:2, key="+this.key);
|
|
251
287
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
288
|
+
if(this.channelID >= 0){
|
|
289
|
+
this.joinChannel(this.channelID);
|
|
290
|
+
}else if(this.state["src"]){
|
|
291
|
+
this.setState("src", this.state["src"], "string");
|
|
292
|
+
if(this.state["currentTime"]){
|
|
293
|
+
this.setState("currentTime", this.state["currentTime"], "number");
|
|
294
|
+
}else if(this.state["startTime"]){
|
|
295
|
+
this.setState("startTime", this.state["startTime"], "number");
|
|
296
|
+
}
|
|
257
297
|
}
|
|
258
298
|
|
|
259
299
|
if(this.state["paused"] == false){
|
|
@@ -271,6 +311,46 @@ class JsvBaseMedia {
|
|
|
271
311
|
if(this.state["muted"]){
|
|
272
312
|
this.setState("muted", this.state["muted"], "boolean");
|
|
273
313
|
}
|
|
314
|
+
|
|
315
|
+
if(this.state["timeUpdateLess"]){
|
|
316
|
+
this.setState("timeUpdateLess", this.state["timeUpdateLess"], "boolean");
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
if(this.state["keepLastFrame"] == false){
|
|
320
|
+
this.setState("keepLastFrame", this.state["keepLastFrame"], "boolean");
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
if(this.state["aspectRatio"] !== "origin"){
|
|
324
|
+
this.setState("aspectRatio", this.state["aspectRatio"], "string");
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
onVisibilityChangeCallBack(){
|
|
329
|
+
let visible = window.JsView&&window.JsView.getVisibility?(window.JsView.getVisibility()==="show"):true;
|
|
330
|
+
logDebug("playerKey:"+this.key+", 小程序可见状态: "+visible);
|
|
331
|
+
if(visible){
|
|
332
|
+
this.appVisible = visible;
|
|
333
|
+
this.state.paused = this.local.paused;
|
|
334
|
+
this.state.currentTime = this.local.currentTime;
|
|
335
|
+
logDebug("currentTime: "+this.state.currentTime);
|
|
336
|
+
this.initParams();
|
|
337
|
+
}else{
|
|
338
|
+
logDebug("playerKey:"+this.key+", playerCreate: "+this.playerCreate+", channelID: "+this.channelID+", src: "+this.state["src"]);
|
|
339
|
+
if(this.playerCreate){
|
|
340
|
+
if(this.channelID > 0){
|
|
341
|
+
logDebug("leaveChannel");
|
|
342
|
+
window.jsvPlayerBridge.leaveChannel(this.key);
|
|
343
|
+
}else if(this.state["src"]){
|
|
344
|
+
logDebug("unload");
|
|
345
|
+
this.local.currentTime = this.currentTime;
|
|
346
|
+
this.local.paused = this.paused;
|
|
347
|
+
logDebug("currentTime: "+this.local.currentTime);
|
|
348
|
+
this.unload();
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
this.appVisible = visible;
|
|
352
|
+
}
|
|
353
|
+
|
|
274
354
|
}
|
|
275
355
|
|
|
276
356
|
/**
|
|
@@ -284,11 +364,16 @@ class JsvBaseMedia {
|
|
|
284
364
|
* 释放播放器,一般不需要应用逻辑调用,在JsvPlayer高阶组件unmounted处理时调用此接口释放。
|
|
285
365
|
*/
|
|
286
366
|
releasePlayer(){
|
|
367
|
+
logTrace("releasePlayer, key="+this.key+", ref="+this.ref);
|
|
287
368
|
this.ref--;
|
|
288
369
|
if(this.ref === 0){
|
|
289
370
|
if(typeof window.jsvPlayerBridge != "undefined" && window.jsvPlayerBridge){
|
|
290
371
|
window.JMD.unsubscribe(this.key, this._onEvent);
|
|
291
372
|
window.jsvPlayerBridge.ReleasePlayer(this.key);
|
|
373
|
+
if (window.JsView && window.JsView.removeEventCallback) {
|
|
374
|
+
logDebug("playerKey: "+this.key+", onVisibilityChange unregister");
|
|
375
|
+
window.JsView.removeEventCallback(this._onVisibilityChangeCallBack);
|
|
376
|
+
}
|
|
292
377
|
}
|
|
293
378
|
|
|
294
379
|
for(let i=0; i<mediaArray.length; i++){
|
|
@@ -301,7 +386,7 @@ class JsvBaseMedia {
|
|
|
301
386
|
}
|
|
302
387
|
|
|
303
388
|
setHoleID(hole_id){
|
|
304
|
-
|
|
389
|
+
logTrace("setHoleID, key="+this.key+", hole_id="+hole_id);
|
|
305
390
|
if(this.playerCreate){
|
|
306
391
|
this.holeId = hole_id;
|
|
307
392
|
this.holeIdModify = hole_id;
|
|
@@ -315,6 +400,7 @@ class JsvBaseMedia {
|
|
|
315
400
|
* 私有接口,外部不需要调用此接口。
|
|
316
401
|
*/
|
|
317
402
|
onEvent(event_str){
|
|
403
|
+
//logTrace("player event: "+event_str);
|
|
318
404
|
let obj = JSON.parse(event_str);
|
|
319
405
|
let event_obj = JSON.parse(obj.param);
|
|
320
406
|
let event = event_obj.event;
|
|
@@ -322,7 +408,7 @@ class JsvBaseMedia {
|
|
|
322
408
|
switch(event){
|
|
323
409
|
case "onProgress":
|
|
324
410
|
{
|
|
325
|
-
//
|
|
411
|
+
// logDebug("onProgress:"+data);
|
|
326
412
|
if (this.local.isRenderable == false) {
|
|
327
413
|
return;
|
|
328
414
|
}
|
|
@@ -353,13 +439,13 @@ class JsvBaseMedia {
|
|
|
353
439
|
}
|
|
354
440
|
break;
|
|
355
441
|
case "onLoadStart":
|
|
356
|
-
|
|
442
|
+
logDebug("onLoadStart:"+data);
|
|
357
443
|
if(this.hasOwnProperty("onloadstart")){
|
|
358
444
|
this["onloadstart"]();
|
|
359
445
|
}
|
|
360
446
|
break;
|
|
361
447
|
case "onLoad":
|
|
362
|
-
|
|
448
|
+
logDebug("onLoad:"+data);
|
|
363
449
|
this.local.currentTime = data.currentTime;
|
|
364
450
|
this.local.duration = data.duration;
|
|
365
451
|
|
|
@@ -376,7 +462,7 @@ class JsvBaseMedia {
|
|
|
376
462
|
}
|
|
377
463
|
break;
|
|
378
464
|
case "onError":
|
|
379
|
-
|
|
465
|
+
logDebug("onError:"+data);
|
|
380
466
|
this.local.isRenderable = false;
|
|
381
467
|
if(this.hasOwnProperty("onerror")){
|
|
382
468
|
const Error = {
|
|
@@ -398,21 +484,21 @@ class JsvBaseMedia {
|
|
|
398
484
|
case -1010 : // MediaPlayer.MEDIA_ERROR_UNSUPPORTED
|
|
399
485
|
e = Error.MEDIA_ERR_SRC_NOT_SUPPORTED;
|
|
400
486
|
break;
|
|
401
|
-
case -
|
|
487
|
+
case -50001:
|
|
402
488
|
e = Error.MEDIA_ERR_ONLY_ONE_4K;
|
|
403
489
|
}
|
|
404
490
|
this["onerror"](e);
|
|
405
491
|
}
|
|
406
492
|
break;
|
|
407
493
|
case "onSeek":
|
|
408
|
-
|
|
494
|
+
logDebug("onSeek:"+data);
|
|
409
495
|
this.local.isRenderable = false;
|
|
410
496
|
if(this.hasOwnProperty("onseeking")){
|
|
411
497
|
this["onseeking"]();
|
|
412
498
|
}
|
|
413
499
|
break;
|
|
414
500
|
case "onEventExt":
|
|
415
|
-
|
|
501
|
+
logDebug("onEventExt:"+data);
|
|
416
502
|
switch (data.eventExt) {
|
|
417
503
|
case "videoMetadataUpdate" :
|
|
418
504
|
if (this.hasOwnProperty("onloadedmetadata")) {
|
|
@@ -426,18 +512,18 @@ class JsvBaseMedia {
|
|
|
426
512
|
}
|
|
427
513
|
break;
|
|
428
514
|
default:
|
|
429
|
-
|
|
515
|
+
logWarning("unimplentation event ext type = " + data.eventExt);
|
|
430
516
|
break;
|
|
431
517
|
}
|
|
432
518
|
break;
|
|
433
519
|
case "onAudioFocusGain":
|
|
434
|
-
|
|
520
|
+
logDebug("onAudioFocusGain:"+data);
|
|
435
521
|
if(this.hasOwnProperty("onaudiofocusgain")){
|
|
436
522
|
this["onaudiofocusgain"](data);
|
|
437
523
|
}
|
|
438
524
|
break;
|
|
439
525
|
case "onAudioFocusLoss":
|
|
440
|
-
|
|
526
|
+
logDebug("onAudioFocusLoss:"+data);
|
|
441
527
|
if(this.hasOwnProperty("onaudiofocusloss")){
|
|
442
528
|
this["onaudiofocusloss"](data);
|
|
443
529
|
}
|
|
@@ -460,6 +546,30 @@ class JsvBaseMedia {
|
|
|
460
546
|
this["oncanplay"]();
|
|
461
547
|
}
|
|
462
548
|
break;
|
|
549
|
+
case "onTimeShift":
|
|
550
|
+
logDebug("onTimeShift");
|
|
551
|
+
if(this.hasOwnProperty("ontimeshift")){
|
|
552
|
+
this["ontimeshift"](data.seekTime);
|
|
553
|
+
}
|
|
554
|
+
break;
|
|
555
|
+
case "onTimeShifted":
|
|
556
|
+
logDebug("onTimeShifted");
|
|
557
|
+
if(this.hasOwnProperty("ontimeshifted")){
|
|
558
|
+
this["ontimeshifted"]();
|
|
559
|
+
}
|
|
560
|
+
break;
|
|
561
|
+
case "onBackLive":
|
|
562
|
+
logDebug("onBackLive");
|
|
563
|
+
if(this.hasOwnProperty("onbacklive")){
|
|
564
|
+
this["onbacklive"]();
|
|
565
|
+
}
|
|
566
|
+
break;
|
|
567
|
+
case "onBackLived":
|
|
568
|
+
logDebug("onBackLived");
|
|
569
|
+
if(this.hasOwnProperty("onbacklived")){
|
|
570
|
+
this["onbacklived"]();
|
|
571
|
+
}
|
|
572
|
+
break;
|
|
463
573
|
default:
|
|
464
574
|
break;
|
|
465
575
|
}
|
|
@@ -476,22 +586,32 @@ class JsvBaseMedia {
|
|
|
476
586
|
* 属性,double类型,当前时间,单位秒,set用于seek操作(起播后)或者设置起播时间(起播前),get用于读取当前时间。
|
|
477
587
|
*/
|
|
478
588
|
get currentTime() {
|
|
589
|
+
if(!this.appVisible){
|
|
590
|
+
return this.local.currentTime;
|
|
591
|
+
}
|
|
592
|
+
|
|
479
593
|
let result = this.getProperty("currentTime");
|
|
480
|
-
if(result != null)
|
|
594
|
+
if(result != null){
|
|
595
|
+
this.local.currentTime = result;
|
|
481
596
|
return result;
|
|
597
|
+
}
|
|
482
598
|
return 0;
|
|
483
599
|
}
|
|
484
600
|
|
|
485
601
|
set currentTime(value) {
|
|
486
602
|
this.local.isRenderable = false;
|
|
487
603
|
this.local.currentTime = value;
|
|
488
|
-
this.setState("
|
|
604
|
+
this.setState("currentTime", value, "number");
|
|
489
605
|
}
|
|
490
606
|
|
|
491
607
|
/**
|
|
492
608
|
* 属性,double类型,总时长,单位秒,只支持读取。
|
|
493
609
|
*/
|
|
494
610
|
get duration() {
|
|
611
|
+
if(!this.appVisible){
|
|
612
|
+
return this.local.duration;
|
|
613
|
+
}
|
|
614
|
+
|
|
495
615
|
let result = this.getProperty("duration");
|
|
496
616
|
if(result != null)
|
|
497
617
|
return result;
|
|
@@ -527,11 +647,7 @@ class JsvBaseMedia {
|
|
|
527
647
|
* 属性,boolean类型,当前pause状态,只支持读取。
|
|
528
648
|
*/
|
|
529
649
|
get paused() {
|
|
530
|
-
|
|
531
|
-
if(result != null)
|
|
532
|
-
return result;
|
|
533
|
-
|
|
534
|
-
return true;
|
|
650
|
+
return this.getState("paused");
|
|
535
651
|
}
|
|
536
652
|
|
|
537
653
|
/**
|
|
@@ -542,7 +658,7 @@ class JsvBaseMedia {
|
|
|
542
658
|
}
|
|
543
659
|
|
|
544
660
|
set playbackRate(value) {
|
|
545
|
-
|
|
661
|
+
logDebug("playbackRate")
|
|
546
662
|
this.setState("rate", value, "number");
|
|
547
663
|
}
|
|
548
664
|
|
|
@@ -571,11 +687,7 @@ class JsvBaseMedia {
|
|
|
571
687
|
* 属性,float类型,播放器音量,0-1.0,只影响当前播放器实例。
|
|
572
688
|
*/
|
|
573
689
|
get volume() {
|
|
574
|
-
|
|
575
|
-
if(result != null)
|
|
576
|
-
return result;
|
|
577
|
-
|
|
578
|
-
return 0;
|
|
690
|
+
return this.getState("volume");
|
|
579
691
|
}
|
|
580
692
|
|
|
581
693
|
set volume(value) {
|
|
@@ -658,6 +770,7 @@ class JsvBaseMedia {
|
|
|
658
770
|
* 暂停
|
|
659
771
|
*/
|
|
660
772
|
pause() {
|
|
773
|
+
this.local.paused = true;
|
|
661
774
|
this.setState("paused", true, "boolean");
|
|
662
775
|
if (this.hasOwnProperty("onpause")) {
|
|
663
776
|
this["onpause"]();
|
|
@@ -668,6 +781,7 @@ class JsvBaseMedia {
|
|
|
668
781
|
* 播放
|
|
669
782
|
*/
|
|
670
783
|
play() {
|
|
784
|
+
this.local.paused = false;
|
|
671
785
|
this.setState("paused", false, "boolean");
|
|
672
786
|
if (this.hasOwnProperty("onplay")) {
|
|
673
787
|
this["onplay"]();
|
|
@@ -694,18 +808,23 @@ class JsvBaseMedia {
|
|
|
694
808
|
* @returns {int} 0,表示成功;-1:表示频道号无效。
|
|
695
809
|
*/
|
|
696
810
|
joinChannel(mixNo){
|
|
811
|
+
logTrace("joinChannel, key="+this.key+", mixNo="+mixNo);
|
|
697
812
|
if(mixNo <= 0){
|
|
698
813
|
return -1;
|
|
699
814
|
}
|
|
700
815
|
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
816
|
+
let ret = 0;
|
|
817
|
+
if(this.playerCreate && this.appVisible){
|
|
818
|
+
ret = window.jsvPlayerBridge.JoinChannel(this.key, mixNo);
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
if(ret >= 0){
|
|
704
822
|
this.channelID = mixNo;
|
|
823
|
+
this.local.paused = false;
|
|
824
|
+
this.setState("paused", false, "boolean");
|
|
705
825
|
}
|
|
706
826
|
|
|
707
|
-
|
|
708
|
-
return 0;
|
|
827
|
+
return ret;
|
|
709
828
|
}
|
|
710
829
|
|
|
711
830
|
/**
|
|
@@ -717,8 +836,9 @@ class JsvBaseMedia {
|
|
|
717
836
|
* @returns {int} 0,表示成功;-1:表示频道号无效。
|
|
718
837
|
*/
|
|
719
838
|
leaveChannel(){
|
|
839
|
+
logTrace("leaveChannel, key="+this.key+", channelID="+this.channelID);
|
|
720
840
|
let ret = 0;
|
|
721
|
-
if(this.playerCreate){
|
|
841
|
+
if(this.playerCreate && this.appVisible){
|
|
722
842
|
ret = window.jsvPlayerBridge.leaveChannel(this.key);
|
|
723
843
|
}
|
|
724
844
|
|
|
@@ -746,6 +866,7 @@ class JsvBaseMedia {
|
|
|
746
866
|
* @return {int} 当前音量,0-100。
|
|
747
867
|
* */
|
|
748
868
|
getGlobalVolume(){
|
|
869
|
+
logTrace("getGlobalVolume, key="+this.key);
|
|
749
870
|
if(typeof window.jsvPlayerBridge !== "undefined"){
|
|
750
871
|
return window.jsvPlayerBridge.getGlobalVolume(100);
|
|
751
872
|
}
|
|
@@ -759,6 +880,7 @@ class JsvBaseMedia {
|
|
|
759
880
|
* @param {int} flags 1表示显示音量调节UI;4表示使用提示音;5表示同时显示音量调节UI和使用提示音。
|
|
760
881
|
* */
|
|
761
882
|
setGlobalVolume(volume, flags){
|
|
883
|
+
logTrace("setGlobalVolume, key="+this.key+", volume="+volume+", flags="+flags);
|
|
762
884
|
if(typeof window.jsvPlayerBridge !== "undefined"){
|
|
763
885
|
return window.jsvPlayerBridge.setGlobalVolume(volume, typeof flags!="undefined"?flags:0, 100);
|
|
764
886
|
}
|
|
@@ -770,6 +892,7 @@ class JsvBaseMedia {
|
|
|
770
892
|
* @param {int} flags FLAG_SHOW_UI(1)表示显示音量调节UI;FLAG_PLAY_SOUND(4)表示使用提示音。两个值可以是或的关系。
|
|
771
893
|
* */
|
|
772
894
|
adjustGlobalVolume(direction, flags){
|
|
895
|
+
logTrace("adjustGlobalVolume, key="+this.key+", direction="+direction+", flags="+flags);
|
|
773
896
|
if(typeof window.jsvPlayerBridge !== "undefined"){
|
|
774
897
|
return window.jsvPlayerBridge.adjustGlobalVolume(direction, typeof flags!="undefined"?flags:0);
|
|
775
898
|
}
|
|
@@ -781,8 +904,9 @@ class JsvBaseMedia {
|
|
|
781
904
|
* @param {int} flags FLAG_SHOW_UI(1)表示显示音量调节UI;FLAG_PLAY_SOUND(4)表示使用提示音。两个值可以是或的关系。android 6.0(包含)以上有效。
|
|
782
905
|
* */
|
|
783
906
|
setGlobalMuted(status, flags){
|
|
907
|
+
logTrace("setGlobalMuted, key="+this.key+", status="+status+", flags="+flags);
|
|
784
908
|
if(typeof window.jsvPlayerBridge !== "undefined"){
|
|
785
|
-
|
|
909
|
+
logDebug("setMuted:"+status);
|
|
786
910
|
window.jsvPlayerBridge.setGlobalMuted(status, typeof flags!="undefined"?flags:0);
|
|
787
911
|
}
|
|
788
912
|
}
|
|
@@ -792,6 +916,7 @@ class JsvBaseMedia {
|
|
|
792
916
|
* @return {boolean} true表示静音,false表示非静音。
|
|
793
917
|
* */
|
|
794
918
|
getGlobalMutedStatus(){
|
|
919
|
+
logTrace("getGlobalMutedStatus, key="+this.key);
|
|
795
920
|
if(typeof window.jsvPlayerBridge !== "undefined"){
|
|
796
921
|
return window.jsvPlayerBridge.getGlobalMutedStatus();
|
|
797
922
|
}
|
|
@@ -801,7 +926,8 @@ class JsvBaseMedia {
|
|
|
801
926
|
* 回到视频的开头。
|
|
802
927
|
*/
|
|
803
928
|
gotoStart(){
|
|
804
|
-
|
|
929
|
+
logTrace("gotoStart, key="+this.key);
|
|
930
|
+
if(this.playerCreate && this.appVisible){
|
|
805
931
|
window.jsvPlayerBridge.gotoStart(this.key);
|
|
806
932
|
}else{
|
|
807
933
|
this.state["currentTime"] = 0;
|
|
@@ -812,7 +938,8 @@ class JsvBaseMedia {
|
|
|
812
938
|
* 到达视频的末尾。
|
|
813
939
|
*/
|
|
814
940
|
gotoEnd(){
|
|
815
|
-
|
|
941
|
+
logTrace("gotoEnd, key="+this.key);
|
|
942
|
+
if(this.playerCreate && this.appVisible){
|
|
816
943
|
window.jsvPlayerBridge.gotoEnd(this.key);
|
|
817
944
|
}
|
|
818
945
|
}
|
|
@@ -822,6 +949,7 @@ class JsvBaseMedia {
|
|
|
822
949
|
* @returns {JsonObject} 包含两个字段:1、timeShift,boolean类型,true表示支持时移;2、timeShiftLength,int类型,最大时移时长。
|
|
823
950
|
*/
|
|
824
951
|
getTimeShiftInfo(){
|
|
952
|
+
logTrace("getTimeShiftInfo, key="+this.key);
|
|
825
953
|
let result = this.getProperty("timeShift");
|
|
826
954
|
if(result != null && result != "")
|
|
827
955
|
return JSON.parse(result);
|
|
@@ -834,7 +962,8 @@ class JsvBaseMedia {
|
|
|
834
962
|
* @param {double} time,值为从当前时间计算向前移动了多长时间,单位秒。
|
|
835
963
|
*/
|
|
836
964
|
setTimeShift(time){
|
|
837
|
-
|
|
965
|
+
logTrace("setTimeShift, key="+this.key+", time"+time);
|
|
966
|
+
if(this.playerCreate && this.appVisible){
|
|
838
967
|
window.jsvPlayerBridge.setTimeShift(this.key, time);
|
|
839
968
|
}
|
|
840
969
|
}
|
|
@@ -844,17 +973,17 @@ class JsvBaseMedia {
|
|
|
844
973
|
*/
|
|
845
974
|
setState(key, value, type) {
|
|
846
975
|
if (typeof(value) !== type) {
|
|
847
|
-
|
|
976
|
+
logWarning("invalid paramter type to set " + key + ". value is not " + type);
|
|
848
977
|
return;
|
|
849
978
|
}
|
|
850
979
|
|
|
851
980
|
this.state[key] = value;
|
|
852
|
-
|
|
981
|
+
logDebug("set " + key + " = " + value);
|
|
853
982
|
|
|
854
983
|
let param = {};
|
|
855
984
|
param[key] = value;
|
|
856
985
|
|
|
857
|
-
if(this.playerCreate){
|
|
986
|
+
if(this.playerCreate && this.appVisible){
|
|
858
987
|
window.jsvPlayerBridge.SetProperty(this.key, JSON.stringify(param));
|
|
859
988
|
}
|
|
860
989
|
}
|
|
@@ -864,8 +993,8 @@ class JsvBaseMedia {
|
|
|
864
993
|
*/
|
|
865
994
|
getState(key) {
|
|
866
995
|
let value = this.state[key];
|
|
867
|
-
|
|
868
|
-
if (typeof value == "undefined" && this.playerCreate) {
|
|
996
|
+
logDebug("get " + key + " = " + value);
|
|
997
|
+
if (typeof value == "undefined" && this.playerCreate && this.appVisible) {
|
|
869
998
|
value = window.jsvPlayerBridge.GetProperty(this.key, key);
|
|
870
999
|
this.state[key] = value;
|
|
871
1000
|
}
|
|
@@ -877,7 +1006,7 @@ class JsvBaseMedia {
|
|
|
877
1006
|
* 私有接口,外部不需要调用此接口。
|
|
878
1007
|
*/
|
|
879
1008
|
getProperty(key){
|
|
880
|
-
if (this.playerCreate && typeof window.jsvPlayerBridge != "undefined") {
|
|
1009
|
+
if (this.playerCreate && typeof window.jsvPlayerBridge != "undefined" && this.appVisible) {
|
|
881
1010
|
let result_str = window.jsvPlayerBridge.GetProperty(this.key, key);
|
|
882
1011
|
if(result_str == null || result_str == "")
|
|
883
1012
|
return null;
|
|
@@ -917,7 +1046,7 @@ class JsvMediaVideo extends JsvMedia {
|
|
|
917
1046
|
* 属性,string类型,设置海报地址,未实现。
|
|
918
1047
|
*/
|
|
919
1048
|
set poster(value) {
|
|
920
|
-
|
|
1049
|
+
logWarning("Video.poster() TODO");
|
|
921
1050
|
}
|
|
922
1051
|
|
|
923
1052
|
/**
|
|
@@ -962,5 +1091,11 @@ export {
|
|
|
962
1091
|
JsvMediaAudio,
|
|
963
1092
|
globalLoadJsvPlayerPlugin,
|
|
964
1093
|
findMediaObjectByKey,
|
|
965
|
-
getJsvPlayerCapabilitySet
|
|
1094
|
+
getJsvPlayerCapabilitySet,
|
|
1095
|
+
setLogLevel,
|
|
1096
|
+
logFatal,
|
|
1097
|
+
logError,
|
|
1098
|
+
logWarning,
|
|
1099
|
+
logDebug,
|
|
1100
|
+
logTrace,
|
|
966
1101
|
}
|