1.1.7-rc.0 • Published 1 year ago

@mycujoo/player-core v1.1.7-rc.0

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

Player core

Based on video.js project

Dependencies

This project's advanced features and some of the core features will require these packages to be used in your project:

react
react-dom
@emotion/react
prop-types
lodash

Usage

To use Player core in a React project, all you need is to install this package:

yarn add @mycujoo/player-react

The minimal setup will look like this:

import Player from '@mycujoo/player-core'
....
// render method of your component
<Player source="path-to-file" />

API

PropTypeDescription
sourcestringPath to m3u8 or mp4 video source, required
autoplayboolhtml5 video tag autoplay attribute
controlsboolhtml5 video tag constrols attribute
playsInlineboolhtml5 video tag playsInline attribute
qualitySelectorboolDetermines if quality selector should be used or not
debugboolToggles debug mode, if it is on video.js
onErrorfunctionIs triggered when video.js throws an error, see vjs errors documentation for more info
onClickfunctionIs triggered when clicking on the player wrapper
onPlayerActivefunctionIs triggered when video is playing every 5 seconds to report healthy playback
onVideoPlayfunctionIs triggered on html5 video tag play event
onVideoPausefunctionIs triggered on html5 video tag pause event
onVideoSeekfunctionIs triggered on html5 video tag seek event
onVideoStartfunctionIs triggered on first occurence of html5 video tag play event
onVideoEndfunctionIs triggered on html5 video tag end event
onVideoJsInitfunctionIs triggered after video.js class is instantiated. The instance is passed as a param

Additionaly the library also exports some videojs generic components that can be used as follows:

import Player, { CustomFullScreenButton, TotalViewers, WatchOnLink } '@mycujoo/player-core'
(props) => {
    const [playerInstance, setPlayerInstance] = useState(null)
    const { totalViewers, isLive } = props

    <Player {...props} onVideoJsInit={instance => setPlayerInstance(instance)}>
        <TotalViewers
            player={playerInstance}
            label=""
            totalViewers={totalViewers}
            show={isLive}
        />
        <CustomFullScreenButton
            player={playerInstance}
            setFullscreen={isFS => console.log(`Player is ${isFS? 'fullscreen' : 'inline'}`)}
        />
        <WatchOnLink
            player={playerInstance}
            url='//external.url.link'
            target = '_blank' // default
            logo = '//logo.url',
            title = 'Watch on MLS',
        />
    </Player>
}

Development

To set up development environment for this project you will need to link player package inside you project, but also link all peer dependencies from you project inside player.

So the steps are following:

  1. Run yarn link inside @mycujoo/player-core repository
  2. Go to your project root and run yarn link @mycujoo/player-core
  3. Go to each of the dependeincy package inside your project's node_modules and run yarn link
  4. Go to @mycujoo/player-core repository again and run yarn link react react-dom @emotion/react prop-types lodash

To speed up the build, make sure that terser and visualizer are disabled in rollupConfig, development config would be created in the future.

To deploy new version to npm: Make sure the version in package.json is updated, then create new tag with version format and push it to the repo:

git tag v1.0.50 -am 'version 50 message'
git push origin v1.0.50

This will trigger a job in CircleCI that will run npm publish and push the changes to npm. Alternatively you can just update the version in package.json and then run npm publish to publish the bundle.

Tests

Run yarn test to run tests.

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.7-rc.0

1 year ago

1.1.5-rc.0

1 year ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.1-rc.0

2 years ago

1.1.1-rc.1

2 years ago

1.1.1-rc.2

2 years ago

1.1.1-rc.3

2 years ago

1.1.1-rc.4

2 years ago

1.1.0-rc.1

2 years ago

1.1.0-rc.0

2 years ago

1.1.0

2 years ago

1.0.26-rc.1

2 years ago

1.0.26-rc.0

2 years ago

1.0.26

2 years ago

1.0.25-rc.13

2 years ago

1.0.25-rc.12

2 years ago

1.0.25-rc.11

2 years ago

1.0.25-rc.10

2 years ago

1.0.25-rc.0

2 years ago

1.0.25

2 years ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.13

2 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

1.0.0-rc.2

3 years ago

1.0.0-rc.1

3 years ago

0.0.54

3 years ago

0.0.52

3 years ago

0.0.51

3 years ago

0.0.50

3 years ago

0.0.49

3 years ago

0.0.48

3 years ago

0.0.47

3 years ago

0.0.46

3 years ago

0.0.45

3 years ago

0.0.43

3 years ago

0.0.42

3 years ago

0.0.41

3 years ago

0.0.40

3 years ago

0.0.39

3 years ago

0.0.38-rc.10

4 years ago

0.0.38-rc.2

4 years ago

0.0.38-rc.1

4 years ago

0.0.38

4 years ago

0.0.37

4 years ago

0.0.36

4 years ago

0.0.35

4 years ago

0.0.34

4 years ago

0.0.32-rc.6

4 years ago

0.0.32-rc.5

4 years ago

0.0.33

4 years ago

0.0.32-rc.4

4 years ago

0.0.32-rc.3

4 years ago

0.0.32-rc.2

4 years ago

0.0.32-rc.1

4 years ago

0.0.32

4 years ago

0.0.31

4 years ago

0.0.30

4 years ago

0.0.29-rc.1

4 years ago

0.0.29-rc.0

4 years ago

0.0.29

4 years ago

0.0.22-rc.3

4 years ago

0.0.22-rc.2

4 years ago

0.0.28

4 years ago

0.0.27

4 years ago

0.0.22-rc.1

4 years ago

0.0.26

4 years ago

0.0.25

4 years ago

0.0.24

4 years ago

0.0.23

4 years ago

0.0.22

4 years ago

0.0.21

4 years ago

0.0.20

4 years ago

0.0.19

4 years ago

0.0.18

4 years ago

0.0.17

4 years ago

0.0.16

4 years ago

0.0.15

4 years ago

0.0.14

4 years ago

0.0.13

4 years ago

0.0.12

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago