souporserious / react-media-player

React audio and video player.
https://souporserious.github.io/react-media-player/
ISC License
470 stars 100 forks source link

Publish as JavaScript module #65

Open talentlessguy opened 5 years ago

talentlessguy commented 5 years ago

Please include .mjs build so we can use it from unpkg with ?module suffix.

Example code with this module:

<script type="module">

// Import things
import htm from 'https://unpkg.com/htm?module'
import { React, ReactDOM } from 'https://unpkg.com/es-react-production'
import { Media, Player, controls } from 'https://unpkg.com/react-media-player?module'
const html = htm.bind(React.createElement)

const { Component } = React
const { render } = ReactDOM

class MediaPlayer extends Component {
  render() {
    return (
      html`<${Media}>
        <div className="media">
          <div className="media-player">
            <${Player} src="http://www.youtube.com/embed/h3YVKTxTOgU" />
          </div>
          <div className="media-controls">
            <${PlayPause} />
            <${MuteUnmute} />
          </div>
        </div>
      </Media>`
    )
  }
}

render(html`<${MediaPlayer} />`, document.getElementById('root'))
</script>

If this is will may take a long time, I can send a PR.

souporserious commented 5 years ago

Yes, if you can add a PR that would be greatly appreciated! 🙏

talentlessguy commented 5 years ago

@souporserious ok, will do soon