kslimani / clappr-ima-plugin

Interactive Media Ads (IMA) SDK plugin for Clappr
MIT License
13 stars 3 forks source link

Add Mute is not working #40

Open rajneesh594 opened 3 years ago

rajneesh594 commented 3 years ago

HI, I am trying to mute the add but it's not working. Following is my code so that you can understand what I have tried maybe this is some issue with the plugin.

`(function (){
        console.log("50001");
        var vd_scr = 'song.webm?t=1';
        var TAG_VMAP = 'https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dskippablelinear&correlator=';
        var player = new Clappr.Player({
            parentId: ".player",
            source: vd_scr,
            width: '100%',
            height: '100%',
            autoPlay:true,
            //mute: true,
            plugins: [
              ClapprImaPlugin,
            ],
            imaPlugin:{
              playInline: true,
              isableNonLinear: true,
              isableNonLinearForIOS: true,
              resetAdOnEnded: true,
              requestAdIfNoAutoplay: true,//always set it to true, to undertand please follow this https://github.com/kslimani/clappr-ima-plugin
              resetAdOnEnded: true,
              imaAdPlayer:{
                  adWillAutoPlay:true,
                  tag: TAG_VMAP,
                  locale: 'us',
                  adWillPlayMuted: true,
                  timeout:300, //The duration in milliseconds to wait for the IMA SDK library to be loaded.
                  maxDuration: 300000,//The maximum duration in milliseconds an ad is displayed

              },
          },
        });

      })();`
kslimani commented 3 years ago

Like described in #20, the player mute option must be set to true. (in your code example, it is commented).

Is any error message displayed in browser console ? (are you testing on desktop, or mobile device ?)

Also do you have a demo/test page to share ? (easier for me to debug/reproduce your issue)

rajneesh594 commented 3 years ago

Here is the code, https://codepen.io/rdk594/pen/vYmjREK, And I have commented on the mute because I don't want to mute the vds, I just want to mute ads. To mute the ad I am using adWillPlayMuted=true, You can check in the code that I have set it true but still, it's not working. Please let me know if I am doing something wrong.

kslimani commented 3 years ago

I forked your code, and i added https to video source and set the mute option to true and it work for me.

https://codepen.io/kslimani/pen/MWmGXxX

Technically, setting mute player option to true adds the muted attribute to the internal video element (which is required to autoplay)

EDIT:

And I have commented on the mute because I don't want to mute the vds, I just want to mute ads.

To my knowledge, you can't mute only the ad and have sound on video content (at least without user consent).