react native - JWPlayer: Pre-roll ads are not playing on Android (Ad Error: 402, 20402) - Stack Overflow

I am using JWPlayer React Native SDK in my project, and I have a problem with pre-roll ads on Android.

I am using JWPlayer React Native SDK in my project, and I have a problem with pre-roll ads on Android. The ads do not play, and I get this error:

Ad Error: VAST media file loading reached a timeout of 8 seconds.
Code: 402, AdErrorCode: 20402

Use this configuration in a React Native project:

const jwConfig = {
  license: 'JWP_LICENSE', // Not required to reproduce the issue
  preload: 'auto',
  autostart: true,
  title: 'Single Inline Linear Preroll',
  playlist: [
    {
      title: 'Single Inline Linear Preroll',
      file: '.mp4',
      adschedule: {
        adBreak1: {
          offset: 'pre',
          ad: {
            source: 'googima',
            tag: '.xml',
          },
        },
      },
    },
  ],
  advertising: {
    client: 'googima',
  },
};

Set up build.gradle like this:

buildscript {
    ext {
        buildToolsVersion = "34.0.0"
        minSdkVersion = 21
        compileSdkVersion = 34
        targetSdkVersion = 34
        ndkVersion = "25.1.8937393"
        kotlinVersion = "1.8.0"
        RNJWPlayerUseGoogleIMA = true
    }
    repositories {
        google()
        mavenCentral()
        maven {
            url '/'
        }
    }
    dependencies {
        classpath("com.android.tools.build:gradle")
        classpath("com.facebook.react:react-native-gradle-plugin")
        classpath(".jetbrains.kotlin:kotlin-gradle-plugin")
    }

    allprojects {
        repositories {
            mavenLocal()
            google()
            mavenCentral()
            maven {
                url '/'
            }
        }
    }
}

The pre-roll ad does not play. Check the logs, and you will see this error:

[DEBUG] onPlayerAdError:
{
  error: 'Ad Error: VAST media file loading reached a timeout of 8 seconds.',
  code: 402,
  adErrorCode: 20402,
  message: 'onPlayerAdError'
}

To test this issue, you can use this ready-to-run repository: jwplayer-ads-issue

I have tested with other valid ad tags and video files, but the problem remains the same. Does anyone know how to fix this issue?

I am using JWPlayer React Native SDK in my project, and I have a problem with pre-roll ads on Android. The ads do not play, and I get this error:

Ad Error: VAST media file loading reached a timeout of 8 seconds.
Code: 402, AdErrorCode: 20402

Use this configuration in a React Native project:

const jwConfig = {
  license: 'JWP_LICENSE', // Not required to reproduce the issue
  preload: 'auto',
  autostart: true,
  title: 'Single Inline Linear Preroll',
  playlist: [
    {
      title: 'Single Inline Linear Preroll',
      file: 'https://content.bitsontherun/videos/q1fx20VZ-52qL9xLP.mp4',
      adschedule: {
        adBreak1: {
          offset: 'pre',
          ad: {
            source: 'googima',
            tag: 'https://video.doubleverify/tester/fixtures/vast/vast3.xml',
          },
        },
      },
    },
  ],
  advertising: {
    client: 'googima',
  },
};

Set up build.gradle like this:

buildscript {
    ext {
        buildToolsVersion = "34.0.0"
        minSdkVersion = 21
        compileSdkVersion = 34
        targetSdkVersion = 34
        ndkVersion = "25.1.8937393"
        kotlinVersion = "1.8.0"
        RNJWPlayerUseGoogleIMA = true
    }
    repositories {
        google()
        mavenCentral()
        maven {
            url 'https://mvn.jwplayer/content/repositories/releases/'
        }
    }
    dependencies {
        classpath("com.android.tools.build:gradle")
        classpath("com.facebook.react:react-native-gradle-plugin")
        classpath(".jetbrains.kotlin:kotlin-gradle-plugin")
    }

    allprojects {
        repositories {
            mavenLocal()
            google()
            mavenCentral()
            maven {
                url 'https://mvn.jwplayer/content/repositories/releases/'
            }
        }
    }
}

The pre-roll ad does not play. Check the logs, and you will see this error:

[DEBUG] onPlayerAdError:
{
  error: 'Ad Error: VAST media file loading reached a timeout of 8 seconds.',
  code: 402,
  adErrorCode: 20402,
  message: 'onPlayerAdError'
}

To test this issue, you can use this ready-to-run repository: jwplayer-ads-issue

I have tested with other valid ad tags and video files, but the problem remains the same. Does anyone know how to fix this issue?

Share Improve this question asked Jan 17 at 18:11 sosicksosick 6323 gold badges18 silver badges38 bronze badges 4
  • 2 "The pre-roll ad does not play" that sounds like a good thing? – njzk2 Commented Jan 17 at 18:24
  • Not so funny is that the answer itself is embedded within the joking... Re-arranged: "The sounds that does not play (gives) pre-roll ad like a good thing" ... – VC.One Commented Jan 25 at 12:24
  • @sosick Most likely your problem is related to Android OS not allowing HTML5 videos with sound to autoplay (thus the server side notices that the requested bytes are not moving, and it finally reaches a timeout). (1) Try muting your video player before the ad plays. (2) Test a custom-made XML file with MP4/Webm links of a silent video. – VC.One Commented Jan 25 at 12:29
  • @VC.One unfortunetly did not help. I check the logic as you suggest, but nothing changed to be honest, still have same issue. :( – sosick Commented Jan 27 at 10:57
Add a comment  | 

1 Answer 1

Reset to default 1

I fixed this issue by setting backgroundAudioEnabled: true in jwConfig.

The problem was caused by the missing flag in the configuration. The documentation is lacking in this regard, and the Example player did not have this flag either.

const jwConfig = {
  ...
  backgroundAudioEnabled: true,
};

After adding this, pre-roll ads started working correctly.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745349708a4623756.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信