-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can we use it in React ? #17
Comments
Jsmpeg-player does not support the virtual DOM of React. Defining component -> JsmpegPlayer.js import React, {Component} from 'react';
import JSMpeg from '@cycjimmy/jsmpeg-player';
export default class JsmpegPlayer extends Component {
constructor(props) {
super(props);
this.els = {
videoWrapper: null,
};
};
render() {
return (
<div
className={this.props.wrapperClassName}
ref={videoWrapper => this.els.videoWrapper = videoWrapper}>
</div>
);
};
componentDidMount() {
// Reference documentation, pay attention to the order of parameters.
// https://github.com/cycjimmy/jsmpeg-player#usage
new JSMpeg.VideoElement(
this.els.videoWrapper,
this.props.videoUrl,
this.props.options,
this.props.overlayOptions
);
};
};
}; Using component -> App.js function App() {
return (
...
<JsmpegPlayer
wrapperClassName="video-wrapper"
videoUrl="..."
options={...}
overlayOptions={...}
/>
...
);
} Preview |
Hello @cycjimmy thanks for your response . |
|
How do i do that ? |
|
Thanks ! |
sorry if I am asking many questions but i am new to this :) |
You can use WebSockets to support streaming. |
@cycjimmy could you possible create react hooks version of that ? I really need it for live streaming |
Hello , I came to this tool and I am wondering if there is a way that i can use this as a react component .
Thanks
The text was updated successfully, but these errors were encountered: