Я хочу воспроизводить видео с одного из URL-адресов путем потоковой передачи в reactjs, поддерживает ли это Видео-реакция, может ли кто-нибудь мне помочь.





Да! В их документации здесь вы можете увидеть, как они создают источник с использованием потоковой передачи HLS:
import React, { Component } from 'react';
import Hls from 'hls.js';
export default class HLSSource extends Component {
constructor(props, context) {
super(props, context);
this.hls = new Hls();
}
componentDidMount() {
// `src` is the property get from this component
// `video` is the property insert from `Video` component
// `video` is the html5 video element
const { src, video } = this.props;
// load hls video source base on hls.js
if (Hls.isSupported()) {
this.hls.loadSource(src);
this.hls.attachMedia(video);
this.hls.on(Hls.Events.MANIFEST_PARSED, () => {
video.play();
});
}
}
componentWillUnmount() {
// destroy hls video source
if (this.hls) {
this.hls.destroy();
}
}
render() {
return (
<source
src = {this.props.src}
type = {this.props.type || 'application/x-mpegURL'}
/>
);
}
}
И используйте это в своем коде:
import React from 'react';
import { Player } from 'video-react';
import HLSSource from './HLSSource';
export default (props) => {
// Add customized HLSSource component into video-react Player
// The Component with `isVideoChild` attribute will be added into video` component
// Please use this url if you test it from local:
// http://www.streambox.fr/playlists/x36xhzz/x36xhzz.m3u8
return (
<Player>
<HLSSource
isVideoChild
src = "//d2zihajmogu5jn.cloudfront.net/bipbop-advanced/bipbop_16x9_variant.m3u8"
/>
</Player>
);
};
попробовал это, но получил цикл экрана загрузки. даже на их демонстрации загрузка зацикливается, то же самое с проблемой здесь github.com/video-react/video-react/issues/167 и codeandbox.io/s/l2k5ql01ol
Спасибо @FrankerZ, я проверю то же самое, если еще что-нибудь вернусь.