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

adVmap URL format not working in Android and iOS, and ads not showing in Android with any vast URL #317

Open RN-Dev-Shubh opened 9 months ago

RN-Dev-Shubh commented 9 months ago

"https://ad.grandprixgroup.com/www/delivery/fc.php?script=bannerTypeHtml:vastInlineBannerTypeHtml:vastInlineHtml&format=vast&nz=1&zones=pre-roll%3D2" The above url is not showing any ads but this url "http://playertest.longtailvideo.com/adtags/vmap2.xml" is working properly for iOS. Can you please help me solve why my url is not working. And it is working only for iOS and ads are not showing in Android. Only video is visible.**

    buildToolsVersion = "33.0.0"
    minSdkVersion = 21
    compileSdkVersion = 33
    targetSdkVersion = 33

    "react": "18.2.0",
    "react-native": "0.72.4",

    "react-native-jw-media-player": "^0.2.39"

and here is my code


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

const MyComponent = ({newItem}) => {
  const config = {
    license:
      Platform.OS === 'ios'
        ? __
        : __,
    advertising: {
      adVmap:
        'https://ad.grandprixgroup.com/www/delivery/fc.php?script=bannerTypeHtml:vastInlineBannerTypeHtml:vastInlineHtml&format=vast&nz=1&zones=pre-roll%3D2',
      adClient: 'vast',
    },
    playlist: [
      {
        mediaId: '1',
        file: newItem?.VideoHDStream,
        autostart: false,
      },
    ],
    styling: {
      colors: {},
    },
  };
  const JWPlayerRef = useRef(null);

  return (
    <View style={{width: '100%', height: 200, backgroundColor: '#000'}}>
      <JWPlayer
        ref={JWPlayerRef}
        stretching="uniform"
        style={{width: '100%', height: 200, backgroundColor: '#000'}}
        config={config}
        onAdError={(event) => console.log('Ad Error:', event)}
      />
    </View>
  );
};

export default MyComponent;
chaimPaneth commented 6 months ago

Hi @bs-SKG

I did some work on the ads functionality in the latest versions can you kindly check if it's working for you.

Thanks.