Closed Visarion closed 5 years ago
the code looks like this:
import MediaPlayer from "hasplayer/hasPlayer";
export default class Dev extends Component { componentWillMount() { var stream = { url: "http://playready.directtaps.net/smoothstreaming/SSWSS720H264/SuperSpeedway_720.ism/Manifest" }; var mediaPlayer = new MediaPlayer(); mediaPlayer.init(document.getElementById("videoPlayer")); mediaPlayer.load(stream); }
render() {
return (
<div>
<video id="videoPlayer" controls="true"></video>
</div>
);
}
}
Hi, Did you try with minifed version of hasplayer (hasplayer.min.js)? There was an issue with this file since v1.13.0. Can you try with latest version (1.14.0)?
Hi Visarion Move ur code to componentDidMount
Hi! I'm trying to integrate the player with React. I downloaded the hasPlayer.js file in my /src, and i try to import it in my component (import MediaPlayer from "hasplayer/hasPlayer";). When i want to initialize it using the code you provided (in componentWillMount() method), i receive this error _TypeError: WEBPACK_IMPORTED_MODULE_4_hasplayerhasPlayerdefault.a is not a constructor_. Can you help me with it? Thank you!