0

So, I've trying to integrate a BoxCast player on my React aplication (the javascript one), and I don't know what to do. Anyone has some ideas that what I can do? PS: My problem with iframe is not responsive, so I've trying with the javascript one.

<div id="boxcast-widget-{video-example}"></div>
<script type="text/javascript"charset="utf-8">
    (function (d, s, c, o) { var js = d.createElement(s), fjs = d.getElementsByTagName(s)[0]; var h = (("https:" == document.location.protocol) ? "https:" : "http:"); js.src = h + "//js.boxcast.com/v3.min.js"; js.onload = function () { boxcast.noConflict()("#boxcast-widget-" + c).loadChannel(c, o); }; js.charset = "utf-8"; fjs.parentNode.insertBefore(js, fjs); }(document, "script", "{video-example}", { "showTitle": 0, "showDescription": 0, "showHighlights": 0, "showRelated": false, "showCountdown": false, "market": "smb", "showDocuments": false, "showIndex": false, "showDonations": false, "autoplay": "try-muted", "playInline": true, "dvr": false }));
</script>

Thanks!

3
  • Please, edit your answer and indent the code correctly or it will impossible to help you. Commented Nov 17, 2020 at 20:29
  • Also, posting minimized code is not going to help, anyhow. Commented Nov 17, 2020 at 20:30
  • This code is from the player, like here: support.boxcast.com/en/articles/4235070 Commented Nov 17, 2020 at 20:41

2 Answers 2

1

You can integrate with something like this:

class BoxCast extends React.Component {
  componentDidMount() {
    const {broadcastChannelId, broadcastId} = this.props;
    this.$el = $(this.el);
    this.context = boxcast(this.$el);
    this.context.loadChannel(broadcastChannelId, {
      autoplay: true,
      showTitle: true,
      showDescription: true,
      showHighlights: true,
      showRelated: false,
      selectedBroadcastId: broadcastId
    });
  }

  componentWillUnmount() {
    this.context.unload();
  }

  render() {
    return <div ref={el => this.el = el} />;
  }
}

And then using it from some other React component:

  return (
    <BoxCast broadcastChannelId={/* Something */} broadcastId={/* Something */} />
  )
Sign up to request clarification or add additional context in comments.

1 Comment

@TaíneFreitas Please, up vote the answer, too ;)
0

This does not looks like its being React compatible. If you insist to use it from React, you'll need to integrate it.

It might be a tedious job and I discourage you from doing that. Look for another provider claiming to be React compatible.

1 Comment

So, in the documentation, they had a Javascript integration, but I not understand very well... boxcast.github.io/boxcast_js_docs/advanced/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.