@dolphinweex/weex-harmony 0.1.107 → 0.1.109

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dolphinweex/weex-harmony",
3
- "version": "0.1.107",
3
+ "version": "0.1.109",
4
4
  "description": "weex harmony adapter",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -57,6 +57,7 @@ export default {
57
57
  loop: this.loop,
58
58
  auto: this.auto,
59
59
  onPlayComplete: this.onPlayComplete,
60
+ preloadImage: this.preloadImage
60
61
  };
61
62
  },
62
63
  },
@@ -69,6 +70,16 @@ export default {
69
70
  onPlayComplete(res) {
70
71
  this.$emit('onPlayComplete', res);
71
72
  },
73
+ preloadImage(res) {
74
+ if (res === 'success') {
75
+ this.$emit('onLoadSuccess', res);
76
+ } else if (res === 'fail') {
77
+ this.$emit('onLoadFail', res);
78
+ } else {
79
+ // 兜底
80
+ this.$emit('preloadImage', res);
81
+ }
82
+ },
72
83
  // 自定义拓展其它逻辑
73
84
  play(params, callback, callbackFail) {
74
85
  weexModule.callNative('apngHandle', {
@@ -36,6 +36,7 @@ export default {
36
36
  embedPosition: 'static',
37
37
  defaultWidth: '100%',
38
38
  defaultHeight: '100%',
39
+ embedId: '',
39
40
  };
40
41
  },
41
42
  name: 'MideaIpcIjkplayerView',
@@ -77,6 +78,10 @@ export default {
77
78
  type: Boolean,
78
79
  default: false,
79
80
  },
81
+ isPipMode: {
82
+ type: Boolean,
83
+ default: false,
84
+ },
80
85
  videoResize: {
81
86
  type: Number,
82
87
  default: 0,
@@ -135,21 +140,37 @@ export default {
135
140
  type: Boolean,
136
141
  default: false,
137
142
  },
143
+ monitorFullScreenBtn: {
144
+ type: Boolean,
145
+ default: false,
146
+ },
147
+ monitorBackBtn: {
148
+ type: Boolean,
149
+ default: false,
150
+ },
151
+ // 回放大窗才需要拉取 P2P 信令进度;小窗关闭可减少无效轮询。
152
+ isNeedRequestProgress: {
153
+ type: Boolean,
154
+ default: true,
155
+ },
138
156
  },
139
157
  computed: {
158
+ ref() {
159
+ return this.embedId;
160
+ },
140
161
  hosSameLayerArgs() {
141
162
  return {
142
- ...this.hosUniqueProps, // 鸿蒙原生组件独有属性
163
+ ...this.hosUniqueProps,
143
164
  width: this.width,
144
165
  height: this.height,
145
166
  controls: this.controls,
146
167
  onFullscreenChange: this.onFullscreenChange,
147
- // 视频播放器相关属性
148
168
  config: this.config,
149
169
  muted: this.muted,
150
170
  playStatus: this.playStatus,
151
171
  needDownload: this.needDownload,
152
172
  isSupportScale: this.isSupportScale,
173
+ isPipMode: this.isPipMode,
153
174
  videoResize: this.videoResize,
154
175
  autoplay: this.autoplay,
155
176
  videoCover: this.videoCover,
@@ -162,8 +183,10 @@ export default {
162
183
  data: this.data,
163
184
  src: this.src,
164
185
  isShowTopRightViewOnPortrait: this.isShowTopRightViewOnPortrait,
165
-
166
- // 事件回调
186
+ monitorFullScreenBtn: this.monitorFullScreenBtn,
187
+ monitorBackBtn: this.monitorBackBtn,
188
+ // SameLayer 参数更新会直接触发 native updaeteFn,用于大小窗切换后恢复/停止进度轮询。
189
+ isNeedRequestProgress: this.isNeedRequestProgress,
167
190
  onProgress: this.onProgress,
168
191
  onStart: this.onStart,
169
192
  onPause: this.onPause,
@@ -175,7 +198,10 @@ export default {
175
198
  onStartDownload: this.onStartDownload,
176
199
  onPreviewImageClick: this.onPreviewImageClick,
177
200
  onCaptureCompletion: this.onCaptureCompletion,
178
- onPlayerClick: this.onPlayerClick
201
+ onPlayerClick: this.onPlayerClick,
202
+ onSwitchFullScreen: this.onSwitchFullScreen,
203
+ onClickBack: this.onClickBack,
204
+ onScaleChanged: this.onScaleChanged,
179
205
  };
180
206
  },
181
207
  },
@@ -189,66 +215,63 @@ export default {
189
215
  this.defaultHeight = this.$refs.sameLayer.$el.clientHeight;
190
216
  this.defaultPosition =
191
217
  this.$refs.sameLayer.$el.style.position || 'static';
218
+ this.embedId = this.$refs.sameLayer.embedId;
192
219
  });
193
220
  },
194
221
  methods: {
195
- setSpeed(params){
196
- // {"speed": 1}
197
- console.log('cdj---setSpeed',JSON.stringify(params))
198
- delete params.refId
222
+ setSpeed(params) {
223
+ delete params.refId;
199
224
  weexModule.callNative(
200
225
  'ijkLinkApi',
201
226
  {
202
227
  method: 'setSpeed',
203
228
  name: this.embedId,
204
- params
229
+ params,
205
230
  },
206
231
  callback
207
232
  );
208
233
  },
209
- //{"progress": 221}
210
- seek(params){
211
- console.log('cdj---setSpseekeed',JSON.stringify(params))
212
- delete params.refId
234
+ seek(params) {
235
+ delete params.refId;
213
236
  weexModule.callNative(
214
237
  'ijkLinkApi',
215
238
  {
216
239
  method: 'seek',
217
240
  name: this.embedId,
218
- params
241
+ params,
219
242
  },
220
243
  callback
221
244
  );
222
245
  },
223
- captureImage(params,callback) {
224
- delete params.refId
246
+ captureImage(params, callback) {
247
+ delete params.refId;
225
248
  weexModule.callNative(
226
249
  'ijkLinkApi',
227
250
  {
228
251
  method: 'captureImage',
229
252
  name: this.embedId,
230
- params
253
+ params,
231
254
  },
232
255
  callback
233
256
  );
234
257
  },
235
- finishFullScreen(){
236
- try{
237
- this.$bridge.setPageOrientation({ orientation: 0 })
238
- }catch(e){
258
+ finishFullScreen() {
259
+ try {
260
+ this.$bridge.setPageOrientation({ orientation: 0 });
261
+ } catch (e) {
239
262
  }
240
263
  this.embedPosition = this.defaultPosition;
241
264
  this.embedHeight = this.windowHeight;
242
265
  this.embedWidth = this.windowWidth;
243
266
  },
244
- disabledEvent(){
245
- document.body.style.pointerEvents = 'none'
246
- setTimeout(()=>{
247
- document.body.style.pointerEvents = 'auto'
248
- },1000)
267
+ disabledEvent() {
268
+ document.body.style.pointerEvents = 'none';
269
+ setTimeout(() => {
270
+ document.body.style.pointerEvents = 'auto';
271
+ }, 1000);
249
272
  },
250
273
  onFullscreenChange(isFullScreeen) {
251
- this.disabledEvent()
274
+ this.disabledEvent();
252
275
  if (isFullScreeen.flag) {
253
276
  this.embedPosition = 'fixed';
254
277
  this.embedHeight = this.windowWidth;
@@ -259,58 +282,57 @@ export default {
259
282
  this.embedWidth = this.defaultWidth;
260
283
  }
261
284
  },
262
- // 自定义拓展其它逻辑
263
285
  onProgress(res) {
264
286
  this.$emit('onProgress', res);
265
287
  },
266
-
267
288
  onStart(res) {
268
289
  this.$emit('start', res);
269
290
  },
270
-
271
291
  onPause(res) {
272
292
  this.$emit('Pause', res);
273
293
  },
274
-
275
294
  finish(res) {
276
295
  this.$emit('finish', res);
277
296
  },
278
-
279
297
  onFail(res) {
280
298
  this.$emit('fail', res);
281
299
  },
282
-
283
300
  onReadyToPlay(res) {
284
301
  this.$emit('readyToPlay', res);
285
302
  },
286
-
287
303
  deleteVideo(res) {
288
304
  this.$emit('deleteVideo', res);
289
305
  },
290
-
291
306
  onDownloadSuccess(res) {
292
307
  this.$emit('onDownloadSuccess', res);
293
308
  },
294
-
295
- onStartDownload(res) {
309
+ onStartDownload(res) {
296
310
  this.$emit('onStartDownload', res);
297
311
  },
298
-
299
312
  onPreviewImageClick(res) {
300
313
  this.$emit('onPreviewImageClick', res);
301
314
  },
302
- onCaptureCompletion(res){
315
+ onCaptureCompletion(res) {
303
316
  this.$emit('onCaptureCompletion', res);
304
317
  },
305
- onPlayerClick(res){
318
+ onPlayerClick(res) {
306
319
  this.$emit('onPlayerClick', res);
307
- }
320
+ },
321
+ onSwitchFullScreen(res) {
322
+ this.$emit('onSwitchFullScreen', res);
323
+ },
324
+ onClickBack(res) {
325
+ this.$emit('onClickBack', res);
326
+ },
327
+ onScaleChanged(res) {
328
+ this.$emit('onScaleChanged', res);
329
+ },
330
+ },
331
+ destroy() {
332
+ this.embedPosition = this.defaultPosition;
333
+ this.embedHeight = this.defaultHeight;
334
+ this.embedWidth = this.defaultWidth;
335
+ document.body.style.pointerEvents = 'auto';
308
336
  },
309
- destroy(){
310
- this.embedPosition = this.defaultPosition;
311
- this.embedHeight = this.defaultHeight;
312
- this.embedWidth = this.defaultWidth;
313
- document.body.style.pointerEvents = 'auto'
314
- }
315
337
  };
316
338
  </script>
@@ -1,5 +1,6 @@
1
1
  <template>
2
2
  <BaseSameLayer
3
+ ref="baseSameLayer"
3
4
  :hosSameLayerArgs="hosSameLayerArgs"
4
5
  embedType="native/midea-ipc-live-view"
5
6
  :defaultWidth="300"
@@ -16,6 +17,7 @@ export default {
16
17
  return {
17
18
  width: 0,
18
19
  height: 0,
20
+ embedId: '',
19
21
  };
20
22
  },
21
23
  name: 'MideaIpcLiveView',
@@ -32,7 +34,6 @@ export default {
32
34
  default: '',
33
35
  },
34
36
  videoResize: {
35
- // videoResize?: 0 | 1 | 2; // 0=Aspect,1=AspectFill,2=Resize(容器表现)
36
37
  type: Number,
37
38
  default: '',
38
39
  },
@@ -52,6 +53,10 @@ export default {
52
53
  type: Boolean,
53
54
  default: false,
54
55
  },
56
+ isPipMode: {
57
+ type: Boolean,
58
+ default: false,
59
+ },
55
60
  controls: {
56
61
  type: Boolean,
57
62
  default: false,
@@ -60,6 +65,34 @@ export default {
60
65
  type: Object,
61
66
  default: () => {},
62
67
  },
68
+ channel: {
69
+ type: [Number, String],
70
+ default: 0,
71
+ },
72
+ playStatus: {
73
+ type: String,
74
+ default: '',
75
+ },
76
+ mute: {
77
+ type: [Number, Boolean],
78
+ default: 1,
79
+ },
80
+ writeToFile: {
81
+ type: Number,
82
+ default: 1,
83
+ },
84
+ analyzeDuration: {
85
+ type: Number,
86
+ default: 100000,
87
+ },
88
+ isOnlyOnePlayer: {
89
+ type: Boolean,
90
+ default: true,
91
+ },
92
+ disallowInterceptTouchEvent: {
93
+ type: Boolean,
94
+ default: false,
95
+ },
63
96
  hosUniqueProps: {
64
97
  type: Object,
65
98
  default() {
@@ -74,25 +107,41 @@ export default {
74
107
  },
75
108
  },
76
109
  computed: {
110
+ ref() {
111
+ return this.embedId;
112
+ },
113
+ muted() {
114
+ return this.mute === 1 || this.mute === true;
115
+ },
77
116
  hosSameLayerArgs() {
78
117
  return {
79
- ...this.hosUniqueProps, // 鸿蒙原生组件独有属性
118
+ ...this.hosUniqueProps,
80
119
  width: this.width,
81
120
  height: this.height,
82
121
  data: this.data,
83
122
  src: this.src,
84
123
  url: this.url,
124
+ channel: this.channel,
125
+ playStatus: this.playStatus,
126
+ muted: this.muted,
127
+ mute: this.mute,
128
+ writeToFile: this.writeToFile,
129
+ analyzeDuration: this.analyzeDuration,
130
+ isOnlyOnePlayer: this.isOnlyOnePlayer,
131
+ disallowInterceptTouchEvent: this.disallowInterceptTouchEvent,
85
132
  videoResize: this.videoResize,
86
133
  autoplay: this.autoplay,
87
134
  videoCover: this.videoCover,
88
135
  bottomShadow: this.bottomShadow,
89
136
  isSupportScale: this.isSupportScale,
137
+ isPipMode: this.isPipMode,
90
138
  controls: this.controls,
91
139
  topShadow: this.topShadow,
92
140
  hosUniqueProps: this.hosUniqueProps,
93
141
  onPlayerClick: this.onPlayerClick,
94
142
  onMoveControl: this.onMoveControl,
95
143
  onScaleControl: this.onScaleControl,
144
+ onScaleChanged: this.onScaleChanged,
96
145
  onMoveEnd: this.onMoveEnd,
97
146
  onStatePrepared: this.onStatePrepared,
98
147
  onAutoCompletion: this.onAutoCompletion,
@@ -103,93 +152,103 @@ export default {
103
152
  mounted() {
104
153
  this.width = this.$el.clientWidth;
105
154
  this.height = this.$el.clientHeight;
155
+ this.embedId = this.$refs.baseSameLayer && this.$refs.baseSameLayer.embedId;
156
+ this.syncEmbedSize();
157
+ },
158
+ updated() {
159
+ this.syncEmbedSize();
106
160
  },
107
- watch:{
108
- url(newV){
109
- console.log('cdj-------------url',newV)
110
- }
111
- },
112
161
  methods: {
113
- captureImage(params,callback) {
114
- delete params.refId
162
+ syncEmbedSize() {
163
+ if (!this.$el) {
164
+ return;
165
+ }
166
+ const w = this.$el.clientWidth;
167
+ const h = this.$el.clientHeight;
168
+ if (w > 0 && h > 0 && (w !== this.width || h !== this.height)) {
169
+ this.width = w;
170
+ this.height = h;
171
+ }
172
+ },
173
+ captureImage(params, callback) {
174
+ delete params.refId;
115
175
  weexModule.callNative(
116
176
  'ipcLinkApi',
117
177
  {
118
178
  method: 'captureImage',
119
179
  name: this.embedId,
120
- params
180
+ params,
121
181
  },
122
182
  callback
123
183
  );
124
184
  },
125
- switchVideoQuality(params,callback) {
185
+ switchVideoQuality(params, callback) {
126
186
  weexModule.callNative(
127
187
  'ipcLinkApi',
128
188
  {
129
189
  method: 'switchVideoQuality',
130
190
  name: this.embedId,
131
- params
191
+ params,
132
192
  },
133
193
  callback
134
194
  );
135
195
  },
136
- getVideoNetworkSpeed(params,callback) {
196
+ getVideoNetworkSpeed(params, callback) {
137
197
  weexModule.callNative(
138
198
  'ipcLinkApi',
139
199
  {
140
200
  method: 'getVideoNetworkSpeed',
141
201
  name: this.embedId,
142
- params
202
+ params,
143
203
  },
144
204
  callback
145
205
  );
146
206
  },
147
- startRecord(params,callback) {
207
+ startRecord(params, callback) {
148
208
  weexModule.callNative(
149
209
  'ipcLinkApi',
150
210
  {
151
211
  method: 'startRecord',
152
212
  name: this.embedId,
153
- params
213
+ params,
154
214
  },
155
215
  callback
156
216
  );
157
217
  },
158
- stopRecord(params,callback) {
218
+ stopRecord(params, callback) {
159
219
  weexModule.callNative(
160
220
  'ipcLinkApi',
161
221
  {
162
222
  method: 'stopRecord',
163
223
  name: this.embedId,
164
- params
224
+ params,
165
225
  },
166
226
  callback
167
227
  );
168
228
  },
169
- changeAudioStatus(params,callback){
229
+ changeAudioStatus(params, callback) {
170
230
  weexModule.callNative(
171
231
  'ipcLinkApi',
172
232
  {
173
233
  method: 'changeAudioStatus',
174
234
  name: this.embedId,
175
- params
235
+ params,
176
236
  },
177
237
  callback
178
238
  );
179
239
  },
180
- // 自定义拓展其它逻辑
181
240
  onPlayerClick(res) {
182
241
  this.$emit('onPlayerClick', res);
183
242
  },
184
-
185
243
  onMoveControl(res) {
186
244
  this.$emit('onMoveControl', res);
187
245
  },
188
-
189
246
  onScaleControl(res) {
190
247
  this.$emit('onScaleControl', res);
191
248
  },
192
-
249
+ onScaleChanged(res) {
250
+ this.$emit('onScaleChanged', res);
251
+ },
193
252
  onMoveEnd(res) {
194
253
  this.$emit('onMoveEnd', res);
195
254
  },
@@ -49,6 +49,7 @@ export default {
49
49
  height: this.height,
50
50
  data: this.data,
51
51
  handleProgresscycleTap: this.handleProgresscycleTap,
52
+ isVisabled: true //新增参数避免影响到旧插件
52
53
  };
53
54
  return result;
54
55
  },