@shijiu/jsview-vue 0.9.426 → 0.9.490
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/samples/ColorSpace/App.vue +4 -4
- package/samples/DemoHomepage/router.js +16 -1
- 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/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 +45 -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 +212 -89
- package/utils/JsViewEngineWidget/MetroWidget/RootView.vue +4 -3
- package/utils/JsViewEngineWidget/TemplateParser.js +8 -6
- package/utils/JsViewPlugin/JsvPlayer/GetVersion.js +20 -0
- package/utils/JsViewPlugin/JsvPlayer/JsvMedia.js +202 -84
- package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +43 -14
- 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/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/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_DEBUG;
|
|
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
|
|
|
@@ -168,7 +185,10 @@ class JsvBaseMedia {
|
|
|
168
185
|
startTime: 0.0,
|
|
169
186
|
currentTime: 0.0,
|
|
170
187
|
aspectRatio: "origin",
|
|
171
|
-
keepLastFrame:
|
|
188
|
+
keepLastFrame: true,
|
|
189
|
+
timeUpdateLess: false,
|
|
190
|
+
rate: 1.0,
|
|
191
|
+
volume: 1.0,
|
|
172
192
|
};
|
|
173
193
|
|
|
174
194
|
this.local = {
|
|
@@ -176,6 +196,7 @@ class JsvBaseMedia {
|
|
|
176
196
|
playableDuration: 0.0,
|
|
177
197
|
duration: 0.0,
|
|
178
198
|
isRenderable: false,
|
|
199
|
+
paused: true,
|
|
179
200
|
};
|
|
180
201
|
|
|
181
202
|
this.type = type;
|
|
@@ -188,7 +209,9 @@ class JsvBaseMedia {
|
|
|
188
209
|
this.designMapWidth = design_map_width;
|
|
189
210
|
this.channelID = -1;
|
|
190
211
|
this.ref = 1;
|
|
212
|
+
this.appVisible = window.JsView&&window.JsView.getVisibility?(window.JsView.getVisibility()==="show"):true;
|
|
191
213
|
this._onEvent = this.onEvent.bind(this);
|
|
214
|
+
this._onVisibilityChangeCallBack = this.onVisibilityChangeCallBack.bind(this);
|
|
192
215
|
|
|
193
216
|
let found = false;
|
|
194
217
|
for(let i=0; i<mediaArray.length; i++){
|
|
@@ -214,7 +237,7 @@ class JsvBaseMedia {
|
|
|
214
237
|
*/
|
|
215
238
|
buildPlatformInstance() {
|
|
216
239
|
if(typeof window.jsvPlayerBridge=='undefined' || !window.jsvPlayerBridge){
|
|
217
|
-
|
|
240
|
+
logError("no jsvPlayerBridge");
|
|
218
241
|
return;
|
|
219
242
|
}
|
|
220
243
|
|
|
@@ -236,26 +259,37 @@ class JsvBaseMedia {
|
|
|
236
259
|
this.playerCreate = true;
|
|
237
260
|
|
|
238
261
|
window.JMD.subscribe(this.key, this._onEvent);
|
|
262
|
+
if (window.JsView && window.JsView.onVisibilityChange) {
|
|
263
|
+
logDebug("playerKey: "+this.key+", onVisibilityChange register");
|
|
264
|
+
window.JsView.onVisibilityChange(this._onVisibilityChangeCallBack);
|
|
265
|
+
}
|
|
239
266
|
|
|
240
|
-
|
|
267
|
+
logDebug("InitPlayer:1");
|
|
241
268
|
if(this.holeIdModify !== this.holeId){
|
|
242
269
|
window.jsvPlayerBridge.setHoleID(this.key, this.holeIdModify);
|
|
243
270
|
this.holeId = this.holeIdModify;
|
|
244
271
|
}
|
|
245
272
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
this.
|
|
273
|
+
this.appVisible = window.JsView&&window.JsView.getVisibility?(window.JsView.getVisibility()==="show"):true;
|
|
274
|
+
|
|
275
|
+
if(this.appVisible){
|
|
276
|
+
this.initParams();
|
|
250
277
|
}
|
|
278
|
+
}
|
|
251
279
|
|
|
252
|
-
|
|
253
|
-
if(this.
|
|
254
|
-
this.
|
|
255
|
-
}else if(this.state["
|
|
256
|
-
this.setState("
|
|
280
|
+
initParams(){
|
|
281
|
+
if(this.channelID >= 0){
|
|
282
|
+
this.joinChannel(this.channelID);
|
|
283
|
+
}else if(this.state["src"]){
|
|
284
|
+
this.setState("src", this.state["src"], "string");
|
|
285
|
+
if(this.state["currentTime"]){
|
|
286
|
+
this.setState("currentTime", this.state["currentTime"], "number");
|
|
287
|
+
}else if(this.state["startTime"]){
|
|
288
|
+
this.setState("startTime", this.state["startTime"], "number");
|
|
289
|
+
}
|
|
257
290
|
}
|
|
258
291
|
|
|
292
|
+
logDebug("InitPlayer:2");
|
|
259
293
|
if(this.state["paused"] == false){
|
|
260
294
|
this.setState("paused", this.state["paused"], "boolean");
|
|
261
295
|
}
|
|
@@ -271,6 +305,46 @@ class JsvBaseMedia {
|
|
|
271
305
|
if(this.state["muted"]){
|
|
272
306
|
this.setState("muted", this.state["muted"], "boolean");
|
|
273
307
|
}
|
|
308
|
+
|
|
309
|
+
if(this.state["timeUpdateLess"]){
|
|
310
|
+
this.setState("timeUpdateLess", this.state["timeUpdateLess"], "boolean");
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
if(this.state["keepLastFrame"] == false){
|
|
314
|
+
this.setState("keepLastFrame", this.state["keepLastFrame"], "boolean");
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
if(this.state["aspectRatio"] !== "origin"){
|
|
318
|
+
this.setState("aspectRatio", this.state["aspectRatio"], "string");
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
onVisibilityChangeCallBack(){
|
|
323
|
+
let visible = window.JsView&&window.JsView.getVisibility?(window.JsView.getVisibility()==="show"):true;
|
|
324
|
+
logDebug("playerKey:"+this.key+", 小程序可见状态: "+visible);
|
|
325
|
+
if(visible){
|
|
326
|
+
this.appVisible = visible;
|
|
327
|
+
this.state.paused = this.local.paused;
|
|
328
|
+
this.state.currentTime = this.local.currentTime;
|
|
329
|
+
logDebug("currentTime: "+this.state.currentTime);
|
|
330
|
+
this.initParams();
|
|
331
|
+
}else{
|
|
332
|
+
logDebug("playerKey:"+this.key+", playerCreate: "+this.playerCreate+", channelID: "+this.channelID+", src: "+this.state["src"]);
|
|
333
|
+
if(this.playerCreate){
|
|
334
|
+
if(this.channelID > 0){
|
|
335
|
+
logDebug("leaveChannel");
|
|
336
|
+
window.jsvPlayerBridge.leaveChannel(this.key);
|
|
337
|
+
}else if(this.state["src"]){
|
|
338
|
+
logDebug("unload");
|
|
339
|
+
this.local.currentTime = this.currentTime;
|
|
340
|
+
this.local.paused = this.paused;
|
|
341
|
+
logDebug("currentTime: "+this.local.currentTime);
|
|
342
|
+
this.unload();
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
this.appVisible = visible;
|
|
346
|
+
}
|
|
347
|
+
|
|
274
348
|
}
|
|
275
349
|
|
|
276
350
|
/**
|
|
@@ -289,6 +363,10 @@ class JsvBaseMedia {
|
|
|
289
363
|
if(typeof window.jsvPlayerBridge != "undefined" && window.jsvPlayerBridge){
|
|
290
364
|
window.JMD.unsubscribe(this.key, this._onEvent);
|
|
291
365
|
window.jsvPlayerBridge.ReleasePlayer(this.key);
|
|
366
|
+
if (window.JsView && window.JsView.removeEventCallback) {
|
|
367
|
+
logDebug("playerKey: "+this.key+", onVisibilityChange unregister");
|
|
368
|
+
window.JsView.removeEventCallback(this._onVisibilityChangeCallBack);
|
|
369
|
+
}
|
|
292
370
|
}
|
|
293
371
|
|
|
294
372
|
for(let i=0; i<mediaArray.length; i++){
|
|
@@ -315,6 +393,7 @@ class JsvBaseMedia {
|
|
|
315
393
|
* 私有接口,外部不需要调用此接口。
|
|
316
394
|
*/
|
|
317
395
|
onEvent(event_str){
|
|
396
|
+
logTrace("player event: "+event_str);
|
|
318
397
|
let obj = JSON.parse(event_str);
|
|
319
398
|
let event_obj = JSON.parse(obj.param);
|
|
320
399
|
let event = event_obj.event;
|
|
@@ -322,7 +401,7 @@ class JsvBaseMedia {
|
|
|
322
401
|
switch(event){
|
|
323
402
|
case "onProgress":
|
|
324
403
|
{
|
|
325
|
-
//
|
|
404
|
+
// logDebug("onProgress:"+data);
|
|
326
405
|
if (this.local.isRenderable == false) {
|
|
327
406
|
return;
|
|
328
407
|
}
|
|
@@ -353,13 +432,13 @@ class JsvBaseMedia {
|
|
|
353
432
|
}
|
|
354
433
|
break;
|
|
355
434
|
case "onLoadStart":
|
|
356
|
-
|
|
435
|
+
logDebug("onLoadStart:"+data);
|
|
357
436
|
if(this.hasOwnProperty("onloadstart")){
|
|
358
437
|
this["onloadstart"]();
|
|
359
438
|
}
|
|
360
439
|
break;
|
|
361
440
|
case "onLoad":
|
|
362
|
-
|
|
441
|
+
logDebug("onLoad:"+data);
|
|
363
442
|
this.local.currentTime = data.currentTime;
|
|
364
443
|
this.local.duration = data.duration;
|
|
365
444
|
|
|
@@ -376,7 +455,7 @@ class JsvBaseMedia {
|
|
|
376
455
|
}
|
|
377
456
|
break;
|
|
378
457
|
case "onError":
|
|
379
|
-
|
|
458
|
+
logDebug("onError:"+data);
|
|
380
459
|
this.local.isRenderable = false;
|
|
381
460
|
if(this.hasOwnProperty("onerror")){
|
|
382
461
|
const Error = {
|
|
@@ -398,21 +477,21 @@ class JsvBaseMedia {
|
|
|
398
477
|
case -1010 : // MediaPlayer.MEDIA_ERROR_UNSUPPORTED
|
|
399
478
|
e = Error.MEDIA_ERR_SRC_NOT_SUPPORTED;
|
|
400
479
|
break;
|
|
401
|
-
case -
|
|
480
|
+
case -50001:
|
|
402
481
|
e = Error.MEDIA_ERR_ONLY_ONE_4K;
|
|
403
482
|
}
|
|
404
483
|
this["onerror"](e);
|
|
405
484
|
}
|
|
406
485
|
break;
|
|
407
486
|
case "onSeek":
|
|
408
|
-
|
|
487
|
+
logDebug("onSeek:"+data);
|
|
409
488
|
this.local.isRenderable = false;
|
|
410
489
|
if(this.hasOwnProperty("onseeking")){
|
|
411
490
|
this["onseeking"]();
|
|
412
491
|
}
|
|
413
492
|
break;
|
|
414
493
|
case "onEventExt":
|
|
415
|
-
|
|
494
|
+
logDebug("onEventExt:"+data);
|
|
416
495
|
switch (data.eventExt) {
|
|
417
496
|
case "videoMetadataUpdate" :
|
|
418
497
|
if (this.hasOwnProperty("onloadedmetadata")) {
|
|
@@ -426,18 +505,18 @@ class JsvBaseMedia {
|
|
|
426
505
|
}
|
|
427
506
|
break;
|
|
428
507
|
default:
|
|
429
|
-
|
|
508
|
+
logWarning("unimplentation event ext type = " + data.eventExt);
|
|
430
509
|
break;
|
|
431
510
|
}
|
|
432
511
|
break;
|
|
433
512
|
case "onAudioFocusGain":
|
|
434
|
-
|
|
513
|
+
logDebug("onAudioFocusGain:"+data);
|
|
435
514
|
if(this.hasOwnProperty("onaudiofocusgain")){
|
|
436
515
|
this["onaudiofocusgain"](data);
|
|
437
516
|
}
|
|
438
517
|
break;
|
|
439
518
|
case "onAudioFocusLoss":
|
|
440
|
-
|
|
519
|
+
logDebug("onAudioFocusLoss:"+data);
|
|
441
520
|
if(this.hasOwnProperty("onaudiofocusloss")){
|
|
442
521
|
this["onaudiofocusloss"](data);
|
|
443
522
|
}
|
|
@@ -460,6 +539,30 @@ class JsvBaseMedia {
|
|
|
460
539
|
this["oncanplay"]();
|
|
461
540
|
}
|
|
462
541
|
break;
|
|
542
|
+
case "onTimeShift":
|
|
543
|
+
logDebug("onTimeShift");
|
|
544
|
+
if(this.hasOwnProperty("ontimeshift")){
|
|
545
|
+
this["ontimeshift"](data.seekTime);
|
|
546
|
+
}
|
|
547
|
+
break;
|
|
548
|
+
case "onTimeShifted":
|
|
549
|
+
logDebug("onTimeShifted");
|
|
550
|
+
if(this.hasOwnProperty("ontimeshifted")){
|
|
551
|
+
this["ontimeshifted"]();
|
|
552
|
+
}
|
|
553
|
+
break;
|
|
554
|
+
case "onBackLive":
|
|
555
|
+
logDebug("onBackLive");
|
|
556
|
+
if(this.hasOwnProperty("onbacklive")){
|
|
557
|
+
this["onbacklive"]();
|
|
558
|
+
}
|
|
559
|
+
break;
|
|
560
|
+
case "onBackLived":
|
|
561
|
+
logDebug("onBackLived");
|
|
562
|
+
if(this.hasOwnProperty("onbacklived")){
|
|
563
|
+
this["onbacklived"]();
|
|
564
|
+
}
|
|
565
|
+
break;
|
|
463
566
|
default:
|
|
464
567
|
break;
|
|
465
568
|
}
|
|
@@ -476,22 +579,32 @@ class JsvBaseMedia {
|
|
|
476
579
|
* 属性,double类型,当前时间,单位秒,set用于seek操作(起播后)或者设置起播时间(起播前),get用于读取当前时间。
|
|
477
580
|
*/
|
|
478
581
|
get currentTime() {
|
|
582
|
+
if(!this.appVisible){
|
|
583
|
+
return this.local.currentTime;
|
|
584
|
+
}
|
|
585
|
+
|
|
479
586
|
let result = this.getProperty("currentTime");
|
|
480
|
-
if(result != null)
|
|
587
|
+
if(result != null){
|
|
588
|
+
this.local.currentTime = result;
|
|
481
589
|
return result;
|
|
590
|
+
}
|
|
482
591
|
return 0;
|
|
483
592
|
}
|
|
484
593
|
|
|
485
594
|
set currentTime(value) {
|
|
486
595
|
this.local.isRenderable = false;
|
|
487
596
|
this.local.currentTime = value;
|
|
488
|
-
this.setState("
|
|
597
|
+
this.setState("currentTime", value, "number");
|
|
489
598
|
}
|
|
490
599
|
|
|
491
600
|
/**
|
|
492
601
|
* 属性,double类型,总时长,单位秒,只支持读取。
|
|
493
602
|
*/
|
|
494
603
|
get duration() {
|
|
604
|
+
if(!this.appVisible){
|
|
605
|
+
return this.local.duration;
|
|
606
|
+
}
|
|
607
|
+
|
|
495
608
|
let result = this.getProperty("duration");
|
|
496
609
|
if(result != null)
|
|
497
610
|
return result;
|
|
@@ -527,11 +640,7 @@ class JsvBaseMedia {
|
|
|
527
640
|
* 属性,boolean类型,当前pause状态,只支持读取。
|
|
528
641
|
*/
|
|
529
642
|
get paused() {
|
|
530
|
-
|
|
531
|
-
if(result != null)
|
|
532
|
-
return result;
|
|
533
|
-
|
|
534
|
-
return true;
|
|
643
|
+
return this.getState("paused");
|
|
535
644
|
}
|
|
536
645
|
|
|
537
646
|
/**
|
|
@@ -542,7 +651,7 @@ class JsvBaseMedia {
|
|
|
542
651
|
}
|
|
543
652
|
|
|
544
653
|
set playbackRate(value) {
|
|
545
|
-
|
|
654
|
+
logDebug("playbackRate")
|
|
546
655
|
this.setState("rate", value, "number");
|
|
547
656
|
}
|
|
548
657
|
|
|
@@ -571,11 +680,7 @@ class JsvBaseMedia {
|
|
|
571
680
|
* 属性,float类型,播放器音量,0-1.0,只影响当前播放器实例。
|
|
572
681
|
*/
|
|
573
682
|
get volume() {
|
|
574
|
-
|
|
575
|
-
if(result != null)
|
|
576
|
-
return result;
|
|
577
|
-
|
|
578
|
-
return 0;
|
|
683
|
+
return this.getState("volume");
|
|
579
684
|
}
|
|
580
685
|
|
|
581
686
|
set volume(value) {
|
|
@@ -658,6 +763,7 @@ class JsvBaseMedia {
|
|
|
658
763
|
* 暂停
|
|
659
764
|
*/
|
|
660
765
|
pause() {
|
|
766
|
+
this.local.paused = true;
|
|
661
767
|
this.setState("paused", true, "boolean");
|
|
662
768
|
if (this.hasOwnProperty("onpause")) {
|
|
663
769
|
this["onpause"]();
|
|
@@ -668,6 +774,7 @@ class JsvBaseMedia {
|
|
|
668
774
|
* 播放
|
|
669
775
|
*/
|
|
670
776
|
play() {
|
|
777
|
+
this.local.paused = false;
|
|
671
778
|
this.setState("paused", false, "boolean");
|
|
672
779
|
if (this.hasOwnProperty("onplay")) {
|
|
673
780
|
this["onplay"]();
|
|
@@ -698,14 +805,18 @@ class JsvBaseMedia {
|
|
|
698
805
|
return -1;
|
|
699
806
|
}
|
|
700
807
|
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
808
|
+
let ret = 0;
|
|
809
|
+
if(this.playerCreate && this.appVisible){
|
|
810
|
+
ret = window.jsvPlayerBridge.JoinChannel(this.key, mixNo);
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
if(ret >= 0){
|
|
704
814
|
this.channelID = mixNo;
|
|
815
|
+
this.local.paused = false;
|
|
816
|
+
this.setState("paused", false, "boolean");
|
|
705
817
|
}
|
|
706
818
|
|
|
707
|
-
|
|
708
|
-
return 0;
|
|
819
|
+
return ret;
|
|
709
820
|
}
|
|
710
821
|
|
|
711
822
|
/**
|
|
@@ -718,7 +829,7 @@ class JsvBaseMedia {
|
|
|
718
829
|
*/
|
|
719
830
|
leaveChannel(){
|
|
720
831
|
let ret = 0;
|
|
721
|
-
if(this.playerCreate){
|
|
832
|
+
if(this.playerCreate && this.appVisible){
|
|
722
833
|
ret = window.jsvPlayerBridge.leaveChannel(this.key);
|
|
723
834
|
}
|
|
724
835
|
|
|
@@ -747,6 +858,7 @@ class JsvBaseMedia {
|
|
|
747
858
|
* */
|
|
748
859
|
getGlobalVolume(){
|
|
749
860
|
if(typeof window.jsvPlayerBridge !== "undefined"){
|
|
861
|
+
logDebug("getGlobalVolume");
|
|
750
862
|
return window.jsvPlayerBridge.getGlobalVolume(100);
|
|
751
863
|
}
|
|
752
864
|
|
|
@@ -782,7 +894,7 @@ class JsvBaseMedia {
|
|
|
782
894
|
* */
|
|
783
895
|
setGlobalMuted(status, flags){
|
|
784
896
|
if(typeof window.jsvPlayerBridge !== "undefined"){
|
|
785
|
-
|
|
897
|
+
logDebug("setMuted:"+status);
|
|
786
898
|
window.jsvPlayerBridge.setGlobalMuted(status, typeof flags!="undefined"?flags:0);
|
|
787
899
|
}
|
|
788
900
|
}
|
|
@@ -801,7 +913,7 @@ class JsvBaseMedia {
|
|
|
801
913
|
* 回到视频的开头。
|
|
802
914
|
*/
|
|
803
915
|
gotoStart(){
|
|
804
|
-
if(this.playerCreate){
|
|
916
|
+
if(this.playerCreate && this.appVisible){
|
|
805
917
|
window.jsvPlayerBridge.gotoStart(this.key);
|
|
806
918
|
}else{
|
|
807
919
|
this.state["currentTime"] = 0;
|
|
@@ -812,7 +924,7 @@ class JsvBaseMedia {
|
|
|
812
924
|
* 到达视频的末尾。
|
|
813
925
|
*/
|
|
814
926
|
gotoEnd(){
|
|
815
|
-
if(this.playerCreate){
|
|
927
|
+
if(this.playerCreate && this.appVisible){
|
|
816
928
|
window.jsvPlayerBridge.gotoEnd(this.key);
|
|
817
929
|
}
|
|
818
930
|
}
|
|
@@ -834,7 +946,7 @@ class JsvBaseMedia {
|
|
|
834
946
|
* @param {double} time,值为从当前时间计算向前移动了多长时间,单位秒。
|
|
835
947
|
*/
|
|
836
948
|
setTimeShift(time){
|
|
837
|
-
if(this.playerCreate){
|
|
949
|
+
if(this.playerCreate && this.appVisible){
|
|
838
950
|
window.jsvPlayerBridge.setTimeShift(this.key, time);
|
|
839
951
|
}
|
|
840
952
|
}
|
|
@@ -844,17 +956,17 @@ class JsvBaseMedia {
|
|
|
844
956
|
*/
|
|
845
957
|
setState(key, value, type) {
|
|
846
958
|
if (typeof(value) !== type) {
|
|
847
|
-
|
|
959
|
+
logWarning("invalid paramter type to set " + key + ". value is not " + type);
|
|
848
960
|
return;
|
|
849
961
|
}
|
|
850
962
|
|
|
851
963
|
this.state[key] = value;
|
|
852
|
-
|
|
964
|
+
logDebug("set " + key + " = " + value);
|
|
853
965
|
|
|
854
966
|
let param = {};
|
|
855
967
|
param[key] = value;
|
|
856
968
|
|
|
857
|
-
if(this.playerCreate){
|
|
969
|
+
if(this.playerCreate && this.appVisible){
|
|
858
970
|
window.jsvPlayerBridge.SetProperty(this.key, JSON.stringify(param));
|
|
859
971
|
}
|
|
860
972
|
}
|
|
@@ -864,8 +976,8 @@ class JsvBaseMedia {
|
|
|
864
976
|
*/
|
|
865
977
|
getState(key) {
|
|
866
978
|
let value = this.state[key];
|
|
867
|
-
|
|
868
|
-
if (typeof value == "undefined" && this.playerCreate) {
|
|
979
|
+
logDebug("get " + key + " = " + value);
|
|
980
|
+
if (typeof value == "undefined" && this.playerCreate && this.appVisible) {
|
|
869
981
|
value = window.jsvPlayerBridge.GetProperty(this.key, key);
|
|
870
982
|
this.state[key] = value;
|
|
871
983
|
}
|
|
@@ -877,7 +989,7 @@ class JsvBaseMedia {
|
|
|
877
989
|
* 私有接口,外部不需要调用此接口。
|
|
878
990
|
*/
|
|
879
991
|
getProperty(key){
|
|
880
|
-
if (this.playerCreate && typeof window.jsvPlayerBridge != "undefined") {
|
|
992
|
+
if (this.playerCreate && typeof window.jsvPlayerBridge != "undefined" && this.appVisible) {
|
|
881
993
|
let result_str = window.jsvPlayerBridge.GetProperty(this.key, key);
|
|
882
994
|
if(result_str == null || result_str == "")
|
|
883
995
|
return null;
|
|
@@ -917,7 +1029,7 @@ class JsvMediaVideo extends JsvMedia {
|
|
|
917
1029
|
* 属性,string类型,设置海报地址,未实现。
|
|
918
1030
|
*/
|
|
919
1031
|
set poster(value) {
|
|
920
|
-
|
|
1032
|
+
logWarning("Video.poster() TODO");
|
|
921
1033
|
}
|
|
922
1034
|
|
|
923
1035
|
/**
|
|
@@ -962,5 +1074,11 @@ export {
|
|
|
962
1074
|
JsvMediaAudio,
|
|
963
1075
|
globalLoadJsvPlayerPlugin,
|
|
964
1076
|
findMediaObjectByKey,
|
|
965
|
-
getJsvPlayerCapabilitySet
|
|
1077
|
+
getJsvPlayerCapabilitySet,
|
|
1078
|
+
setLogLevel,
|
|
1079
|
+
logFatal,
|
|
1080
|
+
logError,
|
|
1081
|
+
logWarning,
|
|
1082
|
+
logDebug,
|
|
1083
|
+
logTrace,
|
|
966
1084
|
}
|