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

skipoffset added to AttachPodAds #85

Merged
merged 4 commits into from
Jul 3, 2024
Merged

skipoffset added to AttachPodAds #85

merged 4 commits into from
Jul 3, 2024

Conversation

JinHedman
Copy link
Contributor

We added an attribute to the attachLinear method in AttachPodAds. We set it as 5 seconds but it could be changed to another value or a percentage. Right now it's very straightforward, every ad will be skippable after 5 seconds, assuming they're longer than 5 seconds. We could also make it so that we look for a skipoffset value from the ads properties and if they have one we'll add it to the params of the builder so you can choose skipoffset value or not have one at all.

Also a small sidenote, the skipoffset attribute for the tag is not part of VAST 2.0. The builder will still create a VAST 2.0 XML to the official documentation, that is to say it wont add the attribute to the tag if you choose VAST 2.0.

Added a attribute to the attachLinear method in AttachPodAds. Right now we set it as 5 seconds but it could be changed to another value or a percentage. We could also make it so that we look for a sent in skipoffset value from the sent in params.
@JinHedman JinHedman linked an issue Jun 12, 2024 that may be closed by this pull request
Copy link

@oshinongit oshinongit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@Nfrederiksen Nfrederiksen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I missing something here? (:
I only see one line changed. Are there any other commits to be check in?
The PR description makes it sound like you've provided a way to set the skipoffset or?

I added so you can send in a value for the parameter skipoffset plus a format checker for the parameter. Also added a skipoffset value in the example response in Swagger.
@JinHedman
Copy link
Contributor Author

Hello my apologies, I did not understand that the skipoffset was supposed to be a parameter that the user could input a value to. I've changed it now! I added a isValidSkipOffset in the file vast-maker.js but I'm not sure that it's the best place to put it in! Just holla at me if I should move it elsewhere!

@JinHedman JinHedman requested a review from Nfrederiksen June 13, 2024 16:26
Copy link
Collaborator

@Nfrederiksen Nfrederiksen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Firstly, the ticket could be a little more clearer and have a little more context in it before handing it off to you guys ^^' I see that now. Also, the placement of the isValidSkipOffset() function is ok 👍However, I'd rename the function to 'getSkipOffsetValue' or similar as an 'isValidXXX' function is typically expected to only output true or false.

Secondly, you will need to make sure the vmap-maker can also access the skip offset feature, as we want the VAST's inside the VMAP to include the skipoffset attributes too. Will require a schema update too.

Lastly, I'd like to request some changes to one of the input formats.
I like the idea of having one parameter for skipoffset but with two possible input formats. But I believe it would be better if a user could enter a number of seconds rather than a timecode string, i.e. "5" instead of "00:00:05". Since, it is most likely that a user will only want a few seconds as an offset and it would be cumbersome to have to enter the extra "00:00:" every time.
eg. you should be able to set the parameter either like &skip=50% or &skip=5 where 5 will need to be translated into a timecode string. You will need to write a function for that. and possibly update the regex part in the validation step. (^_^)

Other than that looks good

@JinHedman
Copy link
Contributor Author

Thank you for the feedback @Nfrederiksen. I'll try and have these changes implemented by tomorrow! You've been a huge help for the student development team this iteration, thank you so much! 🙏🏼

Added so that vmap-maker sends in skipoffset as a param into the VastBuilder. I also added a skipoffset variable into the defaultConfigs in vmap-maker.js.
@JinHedman JinHedman requested a review from Nfrederiksen June 15, 2024 22:43
@JinHedman
Copy link
Contributor Author

Heya, I added the skipoffset to the vmap-maker by storing the skipoffset in the params that are sent in to the VastBuilder. I also updated it so that a parameter for skipoffset exists in the vmap endpoint. I also changed the name of isValidSkipOffsetValue to getSkipOffsetValue and added so that you can write the skipoffsets in seconds without having to write it in the "hh:mm:ss" format!

@@ -90,6 +91,7 @@ function VmapBuilder(params) {

const breakpoints = params.breakpoints ? params.breakpoints.split(",").filter((item) => !isNaN(Number(item))) : [];
if (params.preroll) {
//console.log("PARAMS: ",params.generalVastConfigs);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may be removed/cleaned up

@@ -86,6 +86,7 @@ const DEFAULT_AD_LIST = [
*
*/
function VastBuilder(params) {
console.log("VastBuilder params: ", params);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove/Clean up this

Copy link
Collaborator

@Nfrederiksen Nfrederiksen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Summary, Other than some need for clean up and timecode format disabling. The PR looks good.

@@ -351,6 +352,30 @@ function indexOfSmallest(a) {
return lowest;
}

// Validate that params.skipoffset is a valid VAST skipoffset value ("x%" or "hh:mm:ss").
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove this comment too

// "seconds"
const integerSecondsRegex = /^\d+$/;

if (timeFormatRegex.test(skipoffset) || percentageFormatRegex.test(skipoffset)){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep it to just two valid formats and remove the timecode format in this function, eg. "00:00:03" should not set any skipoffset

Cleaned the code a bit, removed console logs and comments. Also removed the "hh:mm:ss" format check in getSkipOffsetValue function in vast-maker.js.
@JinHedman JinHedman requested a review from Nfrederiksen June 19, 2024 12:33
@JinHedman
Copy link
Contributor Author

Did some cleaning up in the code and also removed the "hh:mm:ss" format check in the getSkipOffsetValue! ^^

Copy link
Collaborator

@Nfrederiksen Nfrederiksen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look Good To Me!
Sorry that the final review took some time.

@Nfrederiksen Nfrederiksen merged commit 84603fa into main Jul 3, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Skippable ads
3 participants