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