如何将视频嵌入到React的元素中?
这是我到目前为止尝试过的。
<video autoPlay={true} loop={true} id="intro">
<source src="video here" type="video/mp4" />
</video>
答案 0 :(得分:0)
希望,这会有所帮助:
import { DefaultPlayer as Video } from 'react-html5video';
import 'react-html5video/dist/styles.css';
render() {
return (
<Video autoPlay loop muted
controls={['PlayPause', 'Seek', 'Time', 'Volume', 'Fullscreen']}
poster="Your poster here"
onCanPlayThrough={() => {
// Do stuff
}}>
<source src="video here" type="video/mp4" />
<track label="English" kind="subtitles" srcLang="en" src="http://source.vtt" default />
</Video>
);
}
有关更多详细信息,请参见此处: https://www.npmjs.com/package/react-html5video