Search code examples
jwplayervast

How to Add 2 VAST Ads in JW Player?


I am using JW Player I have one code which works fine but I want 2 midroll vast ads in the player. When I try to Copy and paste the same code with different timings. Code with Higher Time only works.

The Below code workes Fine as ad plays after 5 Minutes, But If I try to copy-paste same code again then Code with higher Timelike 600 seconds then only that code work, the previous one didn't works

advertising: {
                client: "vast",
                schedule: {
                    "myAds": {
                        "offset":300,
                        "tag": "https://www.example.com"
                    }
                }
            },

If I try to Put Code like this then only One ads works...

advertising: {
                client: "vast",
                schedule: {
                    "myAds": {
                        "offset":300,
                        "tag": "https://www.example.com"
                    }
                }
            },

advertising: {
                client: "vast",
                schedule: {
                    "myAds": {
                        "offset":600,
                        "tag": "https://www.example.com"
                    }
                }
            },

Please Help Me.


Solution

  • You can add 2 VAST ads by using the schedule block:

    advertising: {
                    client: "vast",
                    schedule: [{
                            "offset":300,
                            "tag": "https://www.example.com"
                        }, {
                            "offset":600,
                            "tag": "https://www.example.com"
                        }]
                },
    

    For more information please refer to the docs: https://developer.jwplayer.com/jw-player/docs/developer-guide/advertising/monetize-your-content/#add-multiple-ad-breaks-to-a-player