Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSAI implementation #430

Open
savke24 opened this issue Aug 25, 2022 · 3 comments
Open

SSAI implementation #430

savke24 opened this issue Aug 25, 2022 · 3 comments
Labels

Comments

@savke24
Copy link

savke24 commented Aug 25, 2022

Hi i have idea of trying to implement something like or exactly like Server side adding Ads.

Basically i would like to use this library on client side to fetch VAST tag (which i was able to do) and get ad content url (mp4 file)it self which i than forward to API which is doing slicing in .ts chunks and updating m3u8 manifest.(some basic version of that logic i already have).

What i don't know and can't figure it out is does Vast Tracker require some player object and player events so impression can be successfully executed or it can work with out it and how?

Thank You.

0

@ZacharieTFR
Copy link
Contributor

ZacharieTFR commented Aug 26, 2022

Hello, it seems you're describing the same issue than #429.

No it doesn't need a player object to work but it will need to be initialized with your instance of vast client (optional), the ad object and the creative that you will play. See https://github.com/dailymotion/vast-client-js/blob/master/docs/api/vast-tracker.md for more examples

// with a vastClient instance
const vastTracker = new VASTTracker(vastClient, ad, creative);
// without a vastClient instance
const vastTracker = new VASTTracker(null, ad, creative);

Then you will be responsible to call the VASTTracker trackImpression method at the right time to fire the corresponding VAST trackers. You can check the video tag events on MDN to find the one that correspond the most to your need. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video#events

// loadeddata event will be triggered by the video tag when the first frame of the media has finished loading.
player.addEventListener('loadeddata', () => {
  vastTracker.trackImpression()
});

For other trackers feel free to check all VASTTracker public methods available

Let me know, if it helps 😉

@savke24
Copy link
Author

savke24 commented Aug 29, 2022

Hi @ZacharieTFR thank You for Your respond.

When you say : "

Then you will be responsible to call the VASTTracker trackImpression method at the right time to fire the corresponding trackers.
"

What do you mean by that ?
If call trackImpression method outside of player event, will be fired correctly and before calling that method does video needs to be played ?

@ZacharieTFR
Copy link
Contributor

Yes, it will be fired correctly if the VAST contains an <Impression> element. But the IAB VAST specification says:

All <Impression> URIs in the InLine response and any Wrapper responses preceding it should be triggered at the same time when the impression for the ad occurs, or as close in time as possible to when the impression occurs, to prevent impression-counting discrepancies.

so you must call trackImpression as soon as the ad is displayed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants