Closed vaibhaw-innoraft closed 1 year ago
@vaibhaw-innoraft same happened to me, solved it by using the adVmap property instead (if you can get a vmap for your ads). It must be added to the config object like so:
advertising: { adClient: my_Client, adVmap: my_Vmap },
This is just a work around, this issue needs to be fixed.
@vaibhaw-innoraft Have you found any workaround?
Anyone still facing this issue can use the patch below to fix it.
diff --git a/node_modules/react-native-jw-media-player/android/src/main/java/com/appgoalz/rnjwplayer/RNJWPlayerView.java b/node_modules/react-native-jw-media-player/android/src/main/java/com/appgoalz/rnjwplayer/RNJWPlayerView.java
index 8248d56..bb79d81 100755
--- a/node_modules/react-native-jw-media-player/android/src/main/java/com/appgoalz/rnjwplayer/RNJWPlayerView.java
+++ b/node_modules/react-native-jw-media-player/android/src/main/java/com/appgoalz/rnjwplayer/RNJWPlayerView.java
@@ -651,24 +651,14 @@ public class RNJWPlayerView extends RelativeLayout implements
if (prop.hasKey("advertising")) {
ReadableMap ads = prop.getMap("advertising");
if (ads != null && ads.hasKey("adSchedule")) {
- ReadableMap adSchedule = ads.getMap("adSchedule");
- if (adSchedule.hasKey("tag") && adSchedule.hasKey("offset")) {
- String tag = adSchedule.getString("tag");
- String offset = adSchedule.getString("offset");
-// int skipOffset = prop.getInt("skipOffset");
-// String adTypeStr = prop.getString("adType");
-// List<String> tags = (List<String>) prop.getArray("tags");
-
- AdBreak adBreak = new AdBreak.Builder()
- .tag(tag)
- .offset(offset)
-// .skipOffset(skipOffset)
-// .adType(adTypeStr.equals("LINEAR") ? AdType.LINEAR : AdType.NONLINEAR)
-// .tag(tags)
-// .customParams()
- .build();
-
- adScheduleList.add(adBreak);
+ ReadableArray adSchedule = ads.getArray("adSchedule");
+ for(int i = 0; i < adSchedule.size(); i++){
+ ReadableMap adBreakProp = adSchedule.getMap(i);
+ String offset = adBreakProp.hasKey("offset") ? adBreakProp.getString("offset") : "pre";
+ if(adBreakProp.hasKey("tag")){
+ AdBreak adBreak = new AdBreak.Builder().offset(offset).tag(adBreakProp.getString("tag")).build();
+ adScheduleList.add(adBreak);
+ }
}
if (ads.hasKey("adClient") &&
@chaimPaneth here is the PR
I am using version 0.2.22 When passing below object
advertising = { adSchedule: [ { tag: 'https://pubads.g.doubleclick.net/gampad/ads?slotname=/124319096/external/ad_rule_samples&sz=640x480&ciu_szs=300x250&cust_params=deployment%3Ddevsite%26sample_ar%3Dpremidpost&url=https://developers.google.com/interactive-media-ads/docs/sdks/html5/tags&unviewed_position_start=1&output=xml_vast3&impl=s&env=vp&gdfp_req=1&ad_rule=0&vad_type=linear&vpos=preroll&pod=1&ppos=1&lip=true&min_ad_duration=0&max_ad_duration=30000&vrid=6256&video_doc_id=short_onecue&cmsid=496&kfa=0&tfcd=0', offset: '10', }, ], };
to the config object.