@tarojs/plugin-platform-harmony-ets 4.0.0-beta.0 → 4.0.0-canary.0
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/dist/apis/media/video/VideoContext.ts +56 -7
- package/dist/apis/media/video/index.ts +3 -2
- package/dist/components-harmony-ets/checkbox.ets +50 -31
- package/dist/components-harmony-ets/input.ets +5 -0
- package/dist/components-harmony-ets/picker.ets +35 -1
- package/dist/components-harmony-ets/radio.ets +53 -34
- package/dist/components-harmony-ets/slider.ets +5 -0
- package/dist/components-harmony-ets/switch.ets +40 -23
- package/dist/components-harmony-ets/textArea.ets +5 -0
- package/dist/runtime-ets/dom/element/form.ts +11 -2
- package/dist/runtime-utils.js +41 -11
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.js +41 -11
- package/dist/runtime.js.map +1 -1
- package/package.json +8 -8
|
@@ -1,19 +1,68 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { document } from '@tarojs/runtime'
|
|
3
|
+
|
|
1
4
|
import { temporarilyNotSupport } from '../../utils'
|
|
2
5
|
|
|
6
|
+
import type { TaroVideoElement } from '@tarojs/runtime'
|
|
3
7
|
import type Taro from '@tarojs/taro/types'
|
|
4
8
|
|
|
5
9
|
export class VideoContext implements Taro.VideoContext {
|
|
10
|
+
id: string
|
|
11
|
+
|
|
12
|
+
video: TaroVideoElement
|
|
13
|
+
|
|
14
|
+
controller: VideoController
|
|
15
|
+
|
|
16
|
+
constructor (id: string) {
|
|
17
|
+
this.id = id
|
|
18
|
+
this.video = document.getElementById(id)
|
|
19
|
+
|
|
20
|
+
if (this.video) {
|
|
21
|
+
this.controller = this.video.controller
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
play () {
|
|
26
|
+
if (!this.controller) return
|
|
27
|
+
|
|
28
|
+
this.controller.play()
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
pause () {
|
|
32
|
+
if (!this.controller) return
|
|
33
|
+
|
|
34
|
+
this.controller.pause()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
stop () {
|
|
38
|
+
if (!this.controller) return
|
|
39
|
+
|
|
40
|
+
this.controller.stop()
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
seek (position: number) {
|
|
44
|
+
if (!this.controller) return
|
|
45
|
+
|
|
46
|
+
this.controller.setCurrentTime(position)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
requestFullScreen () {
|
|
50
|
+
if (!this.controller) return
|
|
51
|
+
|
|
52
|
+
this.controller.requestFullscreen(true)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
exitFullScreen () {
|
|
56
|
+
if (!this.controller) return
|
|
57
|
+
|
|
58
|
+
this.controller.exitFullscreen()
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
requestBackgroundPlayback = temporarilyNotSupport('VideoContext.requestBackgroundPlayback')
|
|
6
62
|
exitBackgroundPlayback = temporarilyNotSupport('VideoContext.exitBackgroundPlayback')
|
|
7
|
-
exitFullScreen = temporarilyNotSupport('VideoContext.exitFullScreen')
|
|
8
63
|
exitPictureInPicture = temporarilyNotSupport('VideoContext.exitPictureInPicture')
|
|
9
64
|
hideStatusBar = temporarilyNotSupport('VideoContext.hideStatusBar')
|
|
10
|
-
pause = temporarilyNotSupport('VideoContext.pause')
|
|
11
|
-
play = temporarilyNotSupport('VideoContext.play')
|
|
12
65
|
playbackRate = temporarilyNotSupport('VideoContext.playbackRate')
|
|
13
|
-
requestBackgroundPlayback = temporarilyNotSupport('VideoContext.requestBackgroundPlayback')
|
|
14
|
-
requestFullScreen = temporarilyNotSupport('VideoContext.requestFullScreen')
|
|
15
|
-
seek = temporarilyNotSupport('VideoContext.seek')
|
|
16
66
|
sendDanmu = temporarilyNotSupport('VideoContext.sendDanmu')
|
|
17
67
|
showStatusBar = temporarilyNotSupport('VideoContext.showStatusBar')
|
|
18
|
-
stop = temporarilyNotSupport('VideoContext.stop')
|
|
19
68
|
}
|
|
@@ -26,6 +26,7 @@ import mediaLibrary from '@ohos.multimedia.mediaLibrary'
|
|
|
26
26
|
import { callAsyncFail, callAsyncSuccess, temporarilyNotSupport, validateParams } from '../../utils'
|
|
27
27
|
import { VideoContext } from './VideoContext'
|
|
28
28
|
|
|
29
|
+
import type { TaroAny } from '@tarojs/runtime'
|
|
29
30
|
import type Taro from '@tarojs/taro/types'
|
|
30
31
|
|
|
31
32
|
interface IChooseVideoOptionOHOS {
|
|
@@ -43,8 +44,8 @@ const saveVideoToPhotosAlbumSchema = {
|
|
|
43
44
|
filePath: 'String'
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
export const createVideoContext: typeof Taro.createVideoContext = () => {
|
|
47
|
-
return new VideoContext()
|
|
47
|
+
export const createVideoContext: typeof Taro.createVideoContext = (id: string, _: TaroAny) => {
|
|
48
|
+
return new VideoContext(id)
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
// TODO: 1.返回属性补全
|
|
@@ -63,41 +63,60 @@ function getOptions (node: TaroCheckboxElement): CheckboxOptions {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
@
|
|
67
|
-
export
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
66
|
+
@Component
|
|
67
|
+
export struct TaroCheckbox {
|
|
68
|
+
node: TaroCheckboxElement | null = null
|
|
69
|
+
|
|
70
|
+
aboutToAppear () {
|
|
71
|
+
if (this.node && !this.node._isInit) {
|
|
72
|
+
this.node._isInit = true
|
|
73
|
+
this.node._reset = this.node.checked || false
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
build () {
|
|
78
|
+
if (this.node) {
|
|
79
|
+
Stack() {
|
|
80
|
+
Row() {
|
|
81
|
+
Checkbox(getOptions(this.node))
|
|
82
|
+
.checkboxStyle(getNormalAttributes(this.node))
|
|
83
|
+
.checkboxAttr(getAttributes(this.node))
|
|
84
|
+
.opacity(!!this.node._attrs.disabled ? 0.4 : 1)
|
|
85
|
+
.select(this.node.checked)
|
|
86
|
+
.onChange((value: boolean) => {
|
|
87
|
+
if (this.node) {
|
|
88
|
+
if (!!this.node?._attrs.disabled) {
|
|
89
|
+
this.node.updateComponent()
|
|
90
|
+
} else {
|
|
91
|
+
this.node.updateCheckedValue(value)
|
|
92
|
+
|
|
93
|
+
if (value) {
|
|
94
|
+
const event: TaroEvent = createTaroEvent('change', { detail: { value: this.node?._attrs.value } }, this.node)
|
|
95
|
+
eventHandler(event, 'change', this.node)
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
})
|
|
100
|
+
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
101
|
+
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
102
|
+
if (this.node) {
|
|
103
|
+
this.node._nodeInfo.areaInfo = res[1]
|
|
104
|
+
}
|
|
105
|
+
}))
|
|
106
|
+
.onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
|
|
107
|
+
Text(this.node.textContent)
|
|
108
|
+
.textAlign(TextAlign.Center)
|
|
109
|
+
.opacity(!!this.node._attrs.disabled ? 0.4 : 1)
|
|
110
|
+
}
|
|
111
|
+
.onClick(() => {
|
|
112
|
+
if (this.node) {
|
|
113
|
+
if (!this.node?._attrs.disabled) {
|
|
114
|
+
this.node.checked = !this.node.checked
|
|
84
115
|
}
|
|
85
116
|
}
|
|
86
117
|
})
|
|
87
|
-
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', node), node, ['click']))
|
|
88
|
-
.onAreaChange(getComponentEventCallback(node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
89
|
-
node._nodeInfo.areaInfo = res[1]
|
|
90
|
-
}))
|
|
91
|
-
.onVisibleAreaChange(getNodeThresholds(node) || [0.0, 1.0], getComponentEventCallback(node, VISIBLE_CHANGE_EVENT_NAME))
|
|
92
|
-
Text(node.textContent)
|
|
93
|
-
.textAlign(TextAlign.Center)
|
|
94
|
-
.opacity(!!node._attrs.disabled ? 0.4 : 1)
|
|
95
|
-
}
|
|
96
|
-
.onClick(() => {
|
|
97
|
-
if (!node?._attrs.disabled) {
|
|
98
|
-
node.checked = !node.checked
|
|
99
118
|
}
|
|
100
|
-
}
|
|
119
|
+
}
|
|
101
120
|
}
|
|
102
121
|
}
|
|
103
122
|
|
|
@@ -191,7 +191,7 @@ export struct PickerView {
|
|
|
191
191
|
this.controller?.close()
|
|
192
192
|
})
|
|
193
193
|
Text(this.getText()[0]).fontSize(15).padding({top: 20, bottom: 40}).fontColor('#1aad19').onClick(() => {
|
|
194
|
-
this.emitEvent('change', { value: this.node?.value})
|
|
194
|
+
this.emitEvent('change', { value: this.node?.value })
|
|
195
195
|
this.controller?.close()
|
|
196
196
|
})
|
|
197
197
|
}
|
|
@@ -278,6 +278,40 @@ export default struct TaroPicker {
|
|
|
278
278
|
|
|
279
279
|
aboutToAppear () {
|
|
280
280
|
this.node?.addEventListener('click', this.handleClick)
|
|
281
|
+
|
|
282
|
+
if (this.node && !this.node._isInit) {
|
|
283
|
+
let defaultResetValue: TaroAny = ''
|
|
284
|
+
switch (this.node._attrs.mode) {
|
|
285
|
+
case 'selector':
|
|
286
|
+
defaultResetValue = 0
|
|
287
|
+
break
|
|
288
|
+
case 'multiSelector':
|
|
289
|
+
defaultResetValue = this.node._attrs.range.map((_: TaroAny) => 0)
|
|
290
|
+
break
|
|
291
|
+
case 'time': {
|
|
292
|
+
const hour = new Date().getHours()
|
|
293
|
+
const minute = new Date().getMinutes()
|
|
294
|
+
|
|
295
|
+
defaultResetValue = `${('00'+hour).slice(-2)}:${('00'+minute).slice(-2)}`
|
|
296
|
+
break
|
|
297
|
+
}
|
|
298
|
+
case 'date': {
|
|
299
|
+
const data = new Date().toLocaleDateString().split('/')
|
|
300
|
+
const day = data[1]
|
|
301
|
+
const month = data[0]
|
|
302
|
+
const year = data[2]
|
|
303
|
+
|
|
304
|
+
defaultResetValue = `${year}-${month}-${day}`
|
|
305
|
+
break
|
|
306
|
+
}
|
|
307
|
+
default:
|
|
308
|
+
defaultResetValue = ''
|
|
309
|
+
break
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
this.node._isInit = true
|
|
313
|
+
this.node._reset = this.node.value || defaultResetValue
|
|
314
|
+
}
|
|
281
315
|
}
|
|
282
316
|
|
|
283
317
|
dialogController: CustomDialogController | null = null
|
|
@@ -5,7 +5,7 @@ import { TOUCH_EVENT_MAP } from './utils/constant/event'
|
|
|
5
5
|
import { FlexManager } from './utils/FlexManager'
|
|
6
6
|
import { shouldBindEvent, getNormalAttributes, getNodeThresholds } from './utils/helper'
|
|
7
7
|
|
|
8
|
-
import
|
|
8
|
+
import { TaroEvent, TaroAny, TaroStyleType, HarmonyType, TaroRadioGroupElement, TaroRadioElement } from '@tarojs/runtime'
|
|
9
9
|
|
|
10
10
|
interface RadioAttrs {
|
|
11
11
|
radioStyle?: HarmonyType.RadioStyle
|
|
@@ -63,43 +63,62 @@ function themeStyles(isDisabled: boolean) {
|
|
|
63
63
|
.opacity(isDisabled ? 0.4 : 1)
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
@
|
|
67
|
-
export
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
66
|
+
@Component
|
|
67
|
+
export struct TaroRadio {
|
|
68
|
+
node: TaroRadioElement | null = null
|
|
69
|
+
|
|
70
|
+
aboutToAppear () {
|
|
71
|
+
if (this.node && !this.node._isInit) {
|
|
72
|
+
this.node._isInit = true
|
|
73
|
+
this.node._reset = this.node.checked || false
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
build () {
|
|
78
|
+
if (this.node) {
|
|
79
|
+
Stack() {
|
|
80
|
+
Row() {
|
|
81
|
+
Radio({
|
|
82
|
+
group: this.node.group || this.node.parentNode?._nid || '',
|
|
83
|
+
value: this.node.value || '',
|
|
84
|
+
})
|
|
85
|
+
.checked(this.node.checked)
|
|
86
|
+
.style(getNormalAttributes(this.node))
|
|
87
|
+
.radioAttr(getAttributes(this.node))
|
|
88
|
+
.onChange((value: boolean) => {
|
|
89
|
+
if (this.node) {
|
|
90
|
+
if (!!this.node?._attrs.disabled) {
|
|
91
|
+
this.node.updateComponent()
|
|
92
|
+
} else {
|
|
93
|
+
this.node.updateCheckedValue(value)
|
|
94
|
+
|
|
95
|
+
if (value) {
|
|
96
|
+
const event: TaroEvent = createTaroEvent('change', { detail: { value: this.node?._attrs.value } }, this.node)
|
|
97
|
+
eventHandler(event, 'change', this.node)
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
})
|
|
102
|
+
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
103
|
+
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
104
|
+
if (this.node) {
|
|
105
|
+
this.node._nodeInfo.areaInfo = res[1]
|
|
106
|
+
}
|
|
107
|
+
}))
|
|
108
|
+
.onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
|
|
109
|
+
Text(this.node.textContent)
|
|
110
|
+
.textAlign(TextAlign.Center)
|
|
111
|
+
.opacity(!!this.node?._attrs.disabled ? 0.4 : 1)
|
|
112
|
+
}
|
|
113
|
+
.onClick(() => {
|
|
114
|
+
if (this.node) {
|
|
115
|
+
if (!this.node._checked && !this.node?._attrs.disabled) {
|
|
116
|
+
this.node.checked = !this.node.checked
|
|
86
117
|
}
|
|
87
118
|
}
|
|
88
119
|
})
|
|
89
|
-
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', node), node, ['click']))
|
|
90
|
-
.onAreaChange(getComponentEventCallback(node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
91
|
-
node._nodeInfo.areaInfo = res[1]
|
|
92
|
-
}))
|
|
93
|
-
.onVisibleAreaChange(getNodeThresholds(node) || [0.0, 1.0], getComponentEventCallback(node, VISIBLE_CHANGE_EVENT_NAME))
|
|
94
|
-
Text(node.textContent)
|
|
95
|
-
.textAlign(TextAlign.Center)
|
|
96
|
-
.opacity(!!node?._attrs.disabled ? 0.4 : 1)
|
|
97
|
-
}
|
|
98
|
-
.onClick(() => {
|
|
99
|
-
if (!node._checked && !node?._attrs.disabled) {
|
|
100
|
-
node.checked = !node.checked
|
|
101
120
|
}
|
|
102
|
-
}
|
|
121
|
+
}
|
|
103
122
|
}
|
|
104
123
|
}
|
|
105
124
|
|
|
@@ -56,28 +56,45 @@ function themeStyles(isDisabled: boolean) {
|
|
|
56
56
|
.opacity(isDisabled ? 0.4 : 1)
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
@
|
|
60
|
-
export default
|
|
61
|
-
|
|
62
|
-
type: node._attrs.type !== 'checkbox' ? ToggleType.Switch : ToggleType.Checkbox,
|
|
63
|
-
isOn: node.checked,
|
|
64
|
-
})
|
|
65
|
-
.styles(getNormalAttributes(node))
|
|
66
|
-
.attrs(getAttributes(node))
|
|
67
|
-
.themeStyles(!!node._attrs.disabled)
|
|
68
|
-
.onChange((isOn: boolean) => {
|
|
69
|
-
if (!node?._attrs.disabled) {
|
|
70
|
-
const event: TaroEvent = createTaroEvent('change', { detail: { value: isOn } }, node)
|
|
59
|
+
@Component
|
|
60
|
+
export default struct TaroSwitch {
|
|
61
|
+
node: TaroSwitchElement | null = null
|
|
71
62
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
63
|
+
aboutToAppear () {
|
|
64
|
+
if (this.node && !this.node._isInit) {
|
|
65
|
+
this.node._isInit = true
|
|
66
|
+
this.node._reset = this.node.checked || false
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
build () {
|
|
71
|
+
if (this.node) {
|
|
72
|
+
Toggle({
|
|
73
|
+
type: this.node._attrs.type !== 'checkbox' ? ToggleType.Switch : ToggleType.Checkbox,
|
|
74
|
+
isOn: this.node.checked,
|
|
75
|
+
})
|
|
76
|
+
.styles(getNormalAttributes(this.node))
|
|
77
|
+
.attrs(getAttributes(this.node))
|
|
78
|
+
.themeStyles(!!this.node._attrs.disabled)
|
|
79
|
+
.onChange((isOn: boolean) => {
|
|
80
|
+
if (this.node) {
|
|
81
|
+
if (!this.node?._attrs.disabled) {
|
|
82
|
+
const event: TaroEvent = createTaroEvent('change', { detail: { value: isOn } }, this.node)
|
|
83
|
+
|
|
84
|
+
this.node.updateCheckedValue(isOn)
|
|
85
|
+
eventHandler(event, 'change', this.node)
|
|
86
|
+
} else {
|
|
87
|
+
this.node.updateComponent()
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
})
|
|
91
|
+
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
92
|
+
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
93
|
+
if (this.node) {
|
|
94
|
+
this.node._nodeInfo.areaInfo = res[1]
|
|
95
|
+
}
|
|
96
|
+
}))
|
|
97
|
+
.onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
|
|
98
|
+
}
|
|
99
|
+
}
|
|
83
100
|
}
|
|
@@ -31,6 +31,8 @@ interface FormWidgetProps extends StandardProps {
|
|
|
31
31
|
class TaroFormWidgetElement<T extends FormWidgetProps = FormWidgetProps> extends TaroElement<T> {
|
|
32
32
|
_instance
|
|
33
33
|
|
|
34
|
+
_isInit = false
|
|
35
|
+
|
|
34
36
|
_name = ''
|
|
35
37
|
|
|
36
38
|
_value: TaroAny = ''
|
|
@@ -44,7 +46,6 @@ class TaroFormWidgetElement<T extends FormWidgetProps = FormWidgetProps> extends
|
|
|
44
46
|
|
|
45
47
|
this._name = this._attrs.name || ''
|
|
46
48
|
this._value = this._attrs.value || ''
|
|
47
|
-
this._reset = this._attrs.value || ''
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
public setAttribute (name: string, value: any): void {
|
|
@@ -104,7 +105,6 @@ class TaroCheckedElement<T extends StandardProps & { checked?: boolean } = Stand
|
|
|
104
105
|
super(tagName)
|
|
105
106
|
|
|
106
107
|
this._checked = this._attrs.checked || false
|
|
107
|
-
this._reset = this._attrs.checked || false
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
public setAttribute (name: string, value: any): void {
|
|
@@ -262,6 +262,15 @@ class TaroPickerElement extends TaroFormWidgetElement<PickerSelectorProps | Pick
|
|
|
262
262
|
return ''
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
|
+
|
|
266
|
+
public reset() {
|
|
267
|
+
super.reset()
|
|
268
|
+
|
|
269
|
+
const event: TaroEvent = createTaroEvent('change', { detail: { value: this._reset } }, this)
|
|
270
|
+
|
|
271
|
+
event.stopPropagation()
|
|
272
|
+
eventHandler(event, 'change', this)
|
|
273
|
+
}
|
|
265
274
|
}
|
|
266
275
|
|
|
267
276
|
class TaroSwitchElement extends TaroCheckedElement<SwitchProps> {
|
package/dist/runtime-utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isFunction, isString, isArray, isObject, isNull, isNumber, isUndefined, queryToJson, PLATFORM_TYPE, singleQuote, internalComponents } from '@tarojs/shared';
|
|
2
2
|
import _display from '@ohos.display';
|
|
3
|
-
import { Current, window, getPageScrollerOrNode, findChildNodeWithDFS, setNodeEventCallbackAndTriggerComponentUpdate, AREA_CHANGE_EVENT_NAME, disconnectEvent, VISIBLE_CHANGE_EVENT_NAME, hooks } from '@tarojs/runtime';
|
|
3
|
+
import { Current, window, document as document$1, getPageScrollerOrNode, findChildNodeWithDFS, setNodeEventCallbackAndTriggerComponentUpdate, AREA_CHANGE_EVENT_NAME, disconnectEvent, VISIBLE_CHANGE_EVENT_NAME, hooks } from '@tarojs/runtime';
|
|
4
4
|
import { eventCenter, Events, History } from '@tarojs/runtime/dist/runtime.esm';
|
|
5
5
|
import deviceInfo from '@ohos.deviceInfo';
|
|
6
6
|
import i18n from '@ohos.i18n';
|
|
@@ -2306,21 +2306,51 @@ const stopRecord = /* @__PURE__ */ temporarilyNotSupport('stopRecord');
|
|
|
2306
2306
|
const startRecord = /* @__PURE__ */ temporarilyNotSupport('startRecord');
|
|
2307
2307
|
const getRecorderManager = /* @__PURE__ */ temporarilyNotSupport('getRecorderManager');
|
|
2308
2308
|
|
|
2309
|
+
// @ts-nocheck
|
|
2309
2310
|
class VideoContext {
|
|
2310
|
-
constructor() {
|
|
2311
|
+
constructor(id) {
|
|
2312
|
+
this.requestBackgroundPlayback = temporarilyNotSupport('VideoContext.requestBackgroundPlayback');
|
|
2311
2313
|
this.exitBackgroundPlayback = temporarilyNotSupport('VideoContext.exitBackgroundPlayback');
|
|
2312
|
-
this.exitFullScreen = temporarilyNotSupport('VideoContext.exitFullScreen');
|
|
2313
2314
|
this.exitPictureInPicture = temporarilyNotSupport('VideoContext.exitPictureInPicture');
|
|
2314
2315
|
this.hideStatusBar = temporarilyNotSupport('VideoContext.hideStatusBar');
|
|
2315
|
-
this.pause = temporarilyNotSupport('VideoContext.pause');
|
|
2316
|
-
this.play = temporarilyNotSupport('VideoContext.play');
|
|
2317
2316
|
this.playbackRate = temporarilyNotSupport('VideoContext.playbackRate');
|
|
2318
|
-
this.requestBackgroundPlayback = temporarilyNotSupport('VideoContext.requestBackgroundPlayback');
|
|
2319
|
-
this.requestFullScreen = temporarilyNotSupport('VideoContext.requestFullScreen');
|
|
2320
|
-
this.seek = temporarilyNotSupport('VideoContext.seek');
|
|
2321
2317
|
this.sendDanmu = temporarilyNotSupport('VideoContext.sendDanmu');
|
|
2322
2318
|
this.showStatusBar = temporarilyNotSupport('VideoContext.showStatusBar');
|
|
2323
|
-
this.
|
|
2319
|
+
this.id = id;
|
|
2320
|
+
this.video = document$1.getElementById(id);
|
|
2321
|
+
if (this.video) {
|
|
2322
|
+
this.controller = this.video.controller;
|
|
2323
|
+
}
|
|
2324
|
+
}
|
|
2325
|
+
play() {
|
|
2326
|
+
if (!this.controller)
|
|
2327
|
+
return;
|
|
2328
|
+
this.controller.play();
|
|
2329
|
+
}
|
|
2330
|
+
pause() {
|
|
2331
|
+
if (!this.controller)
|
|
2332
|
+
return;
|
|
2333
|
+
this.controller.pause();
|
|
2334
|
+
}
|
|
2335
|
+
stop() {
|
|
2336
|
+
if (!this.controller)
|
|
2337
|
+
return;
|
|
2338
|
+
this.controller.stop();
|
|
2339
|
+
}
|
|
2340
|
+
seek(position) {
|
|
2341
|
+
if (!this.controller)
|
|
2342
|
+
return;
|
|
2343
|
+
this.controller.setCurrentTime(position);
|
|
2344
|
+
}
|
|
2345
|
+
requestFullScreen() {
|
|
2346
|
+
if (!this.controller)
|
|
2347
|
+
return;
|
|
2348
|
+
this.controller.requestFullscreen(true);
|
|
2349
|
+
}
|
|
2350
|
+
exitFullScreen() {
|
|
2351
|
+
if (!this.controller)
|
|
2352
|
+
return;
|
|
2353
|
+
this.controller.exitFullscreen();
|
|
2324
2354
|
}
|
|
2325
2355
|
}
|
|
2326
2356
|
|
|
@@ -2349,8 +2379,8 @@ class VideoContext {
|
|
|
2349
2379
|
const saveVideoToPhotosAlbumSchema = {
|
|
2350
2380
|
filePath: 'String'
|
|
2351
2381
|
};
|
|
2352
|
-
const createVideoContext = () => {
|
|
2353
|
-
return new VideoContext();
|
|
2382
|
+
const createVideoContext = (id, _) => {
|
|
2383
|
+
return new VideoContext(id);
|
|
2354
2384
|
};
|
|
2355
2385
|
// TODO: 1.返回属性补全
|
|
2356
2386
|
// TODO: 2.只支持从相册选择,补充摄像头拍摄功能,需要HarmonyOS提供选择组件
|