Skip to content

Commit 548139c

Browse files
feat(video): cross-platform compatibility (#2720)
* chore: save * chore: update * feat: icon占位 * fix: build * chore: delete useless * fix: arrow * feat(video): harmony适配 * feat(video): harmony适配 * chore: update * chore: update * chore: update * chore: update --------- Co-authored-by: xiaoyatong <[email protected]>
1 parent efb2ff6 commit 548139c

File tree

12 files changed

+40
-37
lines changed

12 files changed

+40
-37
lines changed

packages/nutui-taro-demo/src/pages/index/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Taro from '@tarojs/taro'
2-
import { View, Image, Text, ScrollView, Button, Input } from '@tarojs/components'
2+
import { View, Image, Text, ScrollView, Button, Input, Video } from '@tarojs/components'
33
import pkg from '@/packages/../config.json'
44
import packageJson from '@/packages/../../package.json'
55
import './index.scss'
@@ -10,7 +10,7 @@ const navs = pkg.nav
1010

1111

1212
// hack taro load button xml
13-
console.log(Button, Input )
13+
console.log(Button, Input, Video )
1414

1515
// try {
1616
// console.log('xxx', Schema)

pnpm-lock.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@
11331133
"author": "swag~jun"
11341134
},
11351135
{
1136-
"version": "2.0.0",
1136+
"version": "3.0.0",
11371137
"name": "Video",
11381138
"type": "component",
11391139
"cName": "视频播放器",

src/packages/video/demo.taro.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react'
22
import Taro from '@tarojs/taro'
33
import { ScrollView, View } from '@tarojs/components'
44
import { useTranslate } from '@/sites/assets/locale/taro'
5+
56
import Header from '@/sites/components/header'
67
import Demo1 from './demos/taro/demo1'
78
import Demo2 from './demos/taro/demo2'
@@ -44,9 +45,7 @@ const VideoDemo = () => {
4445
return (
4546
<>
4647
<Header />
47-
<ScrollView
48-
className={`demo full ${Taro.getEnv() === 'WEB' ? 'web' : ''}`}
49-
>
48+
<ScrollView className={`demo ${Taro.getEnv() === 'WEB' ? 'web' : ''}`}>
5049
<View className="h2">{translated.basic}</View>
5150
<Demo1 />
5251
<View className="h2">{translated.autoPlay}</View>

src/packages/video/demos/taro/demo1.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import React, { useState } from 'react'
22
import { Cell, Video } from '@nutui/nutui-react-taro'
3+
import pxTransform from '@/utils/px-transform'
34

45
const Demo1 = () => {
5-
const [source, setSource] = useState({
6+
const [source] = useState({
67
src: 'https://storage.360buyimg.com/nutui/video/video_NutUI.mp4',
78
type: 'video/mp4',
89
})
@@ -14,14 +15,14 @@ const Demo1 = () => {
1415
const playend = (elm: any) => console.log('playend', elm)
1516
return (
1617
<>
17-
<Cell style={{ padding: '0' }}>
18+
<Cell style={{ padding: 0 }}>
1819
<Video
1920
source={source}
2021
options={options}
2122
onPlay={play}
2223
onPause={pause}
2324
onPlayEnd={playend}
24-
style={{ height: '163px' }}
25+
style={{ height: pxTransform(163) }}
2526
/>
2627
</Cell>
2728
</>

src/packages/video/demos/taro/demo2.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import React, { useState } from 'react'
22
import { Cell, Video } from '@nutui/nutui-react-taro'
3+
import pxTransform from '@/utils/px-transform'
34

45
const Demo2 = () => {
5-
const [source, setSource] = useState({
6+
const [source] = useState({
67
src: 'https://storage.360buyimg.com/nutui/video/video_NutUI.mp4',
78
type: 'video/mp4',
89
})
@@ -16,14 +17,14 @@ const Demo2 = () => {
1617
const playend = (elm: any) => console.log('playend', elm)
1718
return (
1819
<>
19-
<Cell style={{ padding: '0' }}>
20+
<Cell style={{ padding: 0 }}>
2021
<Video
2122
source={source}
2223
options={options}
2324
onPlay={play}
2425
onPause={pause}
2526
onPlayEnd={playend}
26-
style={{ height: '163px' }}
27+
style={{ height: pxTransform(163) }}
2728
/>
2829
</Cell>
2930
</>

src/packages/video/demos/taro/demo3.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import React, { useState } from 'react'
22
import { Cell, Video } from '@nutui/nutui-react-taro'
3+
import pxTransform from '@/utils/px-transform'
34

45
const Demo3 = () => {
5-
const [source, setSource] = useState({
6+
const [source] = useState({
67
src: 'https://storage.360buyimg.com/nutui/video/video_NutUI.mp4',
78
type: 'video/mp4',
89
})
@@ -15,14 +16,14 @@ const Demo3 = () => {
1516
const playend = (elm: any) => console.log('playend', elm)
1617
return (
1718
<>
18-
<Cell style={{ padding: '0' }}>
19+
<Cell style={{ padding: 0 }}>
1920
<Video
2021
source={source}
2122
options={options}
2223
onPlay={play}
2324
onPause={pause}
2425
onPlayEnd={playend}
25-
style={{ height: '163px' }}
26+
style={{ height: pxTransform(163) }}
2627
/>
2728
</Cell>
2829
</>

src/packages/video/demos/taro/demo4.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import React, { useState } from 'react'
22
import { Cell, Video } from '@nutui/nutui-react-taro'
3+
import pxTransform from '@/utils/px-transform'
34

45
const Demo4 = () => {
5-
const [source, setSource] = useState({
6+
const [source] = useState({
67
src: 'https://storage.360buyimg.com/nutui/video/video_NutUI.mp4',
78
type: 'video/mp4',
89
})
@@ -23,7 +24,7 @@ const Demo4 = () => {
2324
onPlay={play}
2425
onPause={pause}
2526
onPlayEnd={playend}
26-
style={{ height: '163px' }}
27+
style={{ height: pxTransform(163) }}
2728
/>
2829
</Cell>
2930
</>

src/packages/video/demos/taro/demo5.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import React, { useState } from 'react'
22
import { Cell, Video } from '@nutui/nutui-react-taro'
3+
import pxTransform from '@/utils/px-transform'
34

45
const Demo5 = () => {
5-
const [source, setSource] = useState({
6+
const [source] = useState({
67
src: 'https://storage.360buyimg.com/nutui/video/video_NutUI.mp4',
78
type: 'video/mp4',
89
})
@@ -15,14 +16,14 @@ const Demo5 = () => {
1516
const playend = (elm: any) => console.log('playend', elm)
1617
return (
1718
<>
18-
<Cell style={{ padding: '0' }}>
19+
<Cell style={{ padding: 0 }}>
1920
<Video
2021
source={source}
2122
options={options}
2223
onPlay={play}
2324
onPause={pause}
2425
onPlayEnd={playend}
25-
style={{ height: '163px' }}
26+
style={{ height: pxTransform(163) }}
2627
/>
2728
</Cell>
2829
</>

src/packages/video/demos/taro/demo6.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import React, { useState } from 'react'
22
import { Cell, Video } from '@nutui/nutui-react-taro'
3+
import pxTransform from '@/utils/px-transform'
34

45
const Demo6 = () => {
5-
const [source, setSource] = useState({
6+
const [source] = useState({
67
src: 'https://storage.360buyimg.com/nutui/video/video_NutUI.mp4',
78
type: 'video/mp4',
89
})
@@ -19,14 +20,14 @@ const Demo6 = () => {
1920
const playend = (elm: any) => console.log('playend', elm)
2021
return (
2122
<>
22-
<Cell style={{ padding: '0' }}>
23+
<Cell style={{ padding: 0 }}>
2324
<Video
2425
source={source}
2526
options={options}
2627
onPlay={play}
2728
onPause={pause}
2829
onPlayEnd={playend}
29-
style={{ height: '163px' }}
30+
style={{ height: pxTransform(163) }}
3031
/>
3132
</Cell>
3233
</>

0 commit comments

Comments
 (0)