forked from p96170835/amis
video 增加倍速功能
This commit is contained in:
parent
b9a30e6f7d
commit
cc52c434ba
|
@ -10,6 +10,7 @@
|
|||
| poster | `string` | | 视频封面地址 |
|
||||
| muted | `boolean` | | 是否静音 |
|
||||
| autoPlay | `boolean` | | 是否自动播放 |
|
||||
| rates | `array` | | 倍数,格式为`[1.0, 1.5, 2.0]`|
|
||||
|
||||
```schema:height="500" scope="body"
|
||||
{
|
||||
|
|
|
@ -312,9 +312,6 @@ export class Select extends React.Component<SelectProps, SelectState> {
|
|||
const checkedAll = optionsValues.every(option => selectionValues.indexOf(option) > -1);
|
||||
|
||||
selection = checkedAll ? [] : options;
|
||||
this.setState({
|
||||
selection: selection
|
||||
});
|
||||
onChange(selection);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ export interface CarouselState {
|
|||
}
|
||||
|
||||
export class Carousel extends React.Component<CarouselProps, CarouselState> {
|
||||
wrapperRef: React.RefObject<HTMLDivElement>;
|
||||
wrapperRef: React.RefObject<HTMLDivElement> = React.createRef();
|
||||
intervalTimeout: number;
|
||||
durationTimeout: number;
|
||||
|
||||
|
@ -51,18 +51,12 @@ export class Carousel extends React.Component<CarouselProps, CarouselState> {
|
|||
placeholder: ''
|
||||
};
|
||||
|
||||
constructor(props:CarouselProps) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
current: 0,
|
||||
options: this.props.value ? this.props.value : this.props.options ? this.props.options : [],
|
||||
showArrows: false,
|
||||
nextAnimation: ''
|
||||
};
|
||||
|
||||
this.wrapperRef = React.createRef();
|
||||
}
|
||||
state = {
|
||||
current: 0,
|
||||
options: this.props.value ? this.props.value : this.props.options ? this.props.options : [],
|
||||
showArrows: false,
|
||||
nextAnimation: ''
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
this.prepareAutoSlide();
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
/* eslint fecs-indent: [0, "space", 2, 2] */
|
||||
|
||||
import * as React from 'react';
|
||||
import {Player, Shortcut, BigPlayButton} from 'video-react';
|
||||
import {Player, Shortcut, BigPlayButton, ControlBar, PlaybackRateMenuButton} from 'video-react';
|
||||
import {padArr} from '../utils/helper';
|
||||
import * as cx from 'classnames';
|
||||
import {Renderer, RendererProps} from '../factory';
|
||||
|
@ -396,6 +396,7 @@ export default class Video extends React.Component<VideoProps, VideoState> {
|
|||
playerClassName,
|
||||
classPrefix: ns,
|
||||
aspectRatio,
|
||||
rates
|
||||
} = this.props;
|
||||
|
||||
let source = this.props.src || (name && data && (data as any)[name]) || (amisConfig && amisConfig.value);
|
||||
|
@ -422,6 +423,11 @@ export default class Video extends React.Component<VideoProps, VideoState> {
|
|||
muted={muted}
|
||||
aspectRatio={aspectRatio}
|
||||
>
|
||||
{rates && rates.length ? (
|
||||
<ControlBar>
|
||||
<PlaybackRateMenuButton rates={rates} order={7.1} />
|
||||
</ControlBar>
|
||||
) : null}
|
||||
<BigPlayButton position="center" />
|
||||
{sourceNode}
|
||||
<Shortcut disabled />
|
||||
|
|
Loading…
Reference in New Issue