chaimPaneth / react-native-jw-media-player

React-Native Android/iOS bridge for JWPlayer SDK (https://www.jwplayer.com/)
MIT License
190 stars 91 forks source link

error while updating property 'config' of a view managed by: RNJWPlayerview #316

Closed RN-Dev-Shubh closed 9 months ago

RN-Dev-Shubh commented 10 months ago

Please give any solution for this

RN-Dev-Shubh commented 9 months ago
import {useState, useRef} from 'react';
import JWPlayer from 'react-native-jw-media-player';
import {Platform, View} from 'react-native';

const App = () => {
  const config = {
    license:
      Platform.OS === 'ios'
        ? 'yFmYnxEM3mJy7NnlIVaNTaSc1cHSQuIPpp4HfERZgu2rrl/bANSFezjhYS8CKEm7'
        : 'v7p4bJIubZzH+CKlrh9VklPoeUC2lNIhBtye5YQtFdwCaV9SIJghFTc7PeELz0Hu',
    playlist: [
      {
        mediaId: '1',
        file: 'http://content.bitsontherun.com/videos/3XnJSIm4-injeKYZS.mp4',
        autostart: false,
        adVmap: 'http://playertest.longtailvideo.com/adtags/vmap2.xml',
        adClient: 1,
      },
    ],
    styling: {
      colors: {},
    },
  };

  const JWPlayerRef = useRef(null);

  const onSetupPlayerError = event => {
    console.error('Setup Player Error:', event);
  };

  return (
    <View style={{width: '100%', height: 200, backgroundColor: '#000'}}>
      <JWPlayer
        ref={JWPlayerRef}
        stretching="uniform"
        style={{width: '100%', height: 200, backgroundColor: '#000'}}
        config={config}
        onSetupPlayerError={onSetupPlayerError}
      />
    </View>
  );
};

this code is working properly.

vaibhav19121 commented 6 months ago

can u guide me finding the android SDK Key and IOS SDK KEY in JW player dashboard please?

import {useState, useRef} from 'react';
import JWPlayer from 'react-native-jw-media-player';
import {Platform, View} from 'react-native';

const App = () => {
  const config = {
    license:
      Platform.OS === 'ios'
        ? 'yFmYnxEM3mJy7NnlIVaNTaSc1cHSQuIPpp4HfERZgu2rrl/bANSFezjhYS8CKEm7'
        : 'v7p4bJIubZzH+CKlrh9VklPoeUC2lNIhBtye5YQtFdwCaV9SIJghFTc7PeELz0Hu',
    playlist: [
      {
        mediaId: '1',
        file: 'http://content.bitsontherun.com/videos/3XnJSIm4-injeKYZS.mp4',
        autostart: false,
        adVmap: 'http://playertest.longtailvideo.com/adtags/vmap2.xml',
        adClient: 1,
      },
    ],
    styling: {
      colors: {},
    },
  };

  const JWPlayerRef = useRef(null);

  const onSetupPlayerError = event => {
    console.error('Setup Player Error:', event);
  };

  return (
    <View style={{width: '100%', height: 200, backgroundColor: '#000'}}>
      <JWPlayer
        ref={JWPlayerRef}
        stretching="uniform"
        style={{width: '100%', height: 200, backgroundColor: '#000'}}
        config={config}
        onSetupPlayerError={onSetupPlayerError}
      />
    </View>
  );
};

this code is working properly.