muxinc / mux-stats-sdk-react-native-video

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[mux] A monitor for `null` has not been initialized

siriwatknp opened this issue · comments

Currently when using react-native-video-controls instead of react-native-video the monitor throws an error:

image

"react-native": "0.61.5",
"mux-react-native-video-sdk": "https://github.com/muxinc/mux-stats-sdk-react-native-video#v0.1.0-beta.1",
"react-native-video": "^5.1.0-alpha8",
"react-native-video-controls": "^2.7.1"

using with react-native-video-controls throw error but with pure react-native-video works

sample code

import VideoPlayer from 'react-native-video-controls'

const MuxVideo = muxReactNativeVideo(VideoPlayer)

// render
  <MuxVideo
      source={{ uri }}
      // controls={false}
      style={style}
      onError={() => {
        setIsError(true)
      }}
      resizeMode={'contain'}
      disableBack
      muxOptions={{
        application_name: 'App',
        application_version: '1.0.0',
        data: {
          env_key: 'keey',
          player_software_version: '5.0.2',
          player_name: 'React Native Player',
          video_id: 'video-id',
          video_title: 'My awesome video',
        },
      }}
    />

video_id is required in muxOptions

  muxOptions={{
      application_name: 'KasetGo', // (required) the name of your application
      application_version: '1.0.0', // the version of your application (optional, but encouraged)
      data: {
        env_key: 'ge75aqmj46je04c9m3roe9qol', // (required)
        player_software_version: '5.0.2', // (optionaal, but encouraged) the version of react-native-video that you are using
        player_name: 'React Native Player', // See metadata docs for available metadata fields https://docs.mux.com/docs/web-integration-guide#section-5-add-metadata
        video_id: 'My Video Id',
        video_title: 'My awesome video',
      },
    }}

Hi @siriwatknp apologies for the very delayed response and fix. This issue should be resolved in the latest v0.3.0 release. We've removed the code that was generating a video_id if one wasn't passed, which should resolve this issue. If you are able, could you test again and verify the new version fixes this issue for you?