alibaba / rax

🐰 Rax is a progressive framework for building universal application. https://rax.js.org
Other
7.99k stars 627 forks source link

[BUG]视频播放组件,根据判断手动设置playControl的值,控制台报错:TypeError: node.pause is not a function #2208

Closed yanshengjie closed 3 years ago

yanshengjie commented 3 years ago

循环渲染了多个Video组件 ,当点击下一个时,暂停上一个的播放,通过playControl属性控制是否播放,但是报错node.pause is not a function

截屏2021-08-10 下午3 04 32
ChrisCindy commented 3 years ago

提供一下最小可复现 demo 代码

yanshengjie commented 3 years ago

公共组件 import { createElement, useState } from 'rax'; import View from 'rax-view'; import Video from 'rax-video'; import cls from 'classnames'; import { Button, Icon } from '@alifd/meet'; import { history } from 'rax-app'; import { getPreviewUrl } from '@utils';

import style from './index.module.scss';

const MiniDetail = (props) => { const { className, item = {} } = props; const { exhibit, owner, price, id } = item; const [str,setStr] = useState('pause');

return ( <View className={cls(className, style.miniDetailItem)}> <View className="showcase-cover__container" onClick={()=>{ console.log(111); setStr('play') }}> <Video className={cls('showcase-cover', id)} mode="aspectFit" src={getPreviewUrl(exhibit.preview)} poster={getPreviewUrl(exhibit.cover)} showPlayBtn={false} showFullscreenBtn={false} showCenterPlayBtn showThinProgressBar={false} playControl={str} /> ); };

export default MiniDetail;

yanshengjie commented 3 years ago

调用时 data.map(ele => { return ; })

yanshengjie commented 3 years ago

提供一下最小可复现演示代码

yanshengjie commented 3 years ago

提供一下最小可复现演示代码

OK

yanshengjie commented 3 years ago

提供一下最小可复现演示代码

发到评论区了

ChrisCindy commented 3 years ago

是微信小程序吗

yanshengjie commented 3 years ago

是微信小程序吗 支付宝

ChrisCindy commented 3 years ago

playControl 属性不支持小程序平台,文档里有说明。小程序端如果期望用 js 控制视频的播放,可以使用 https://raxjs.org/docs/api/createVideoContext

ChrisCindy commented 3 years ago

https://github.com/raxjs/rax-components/pull/392

小程序平台现已支持 playControl 属性