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

Bugfix/yospace missing ad events #56

Merged
merged 5 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/lovely-queens-boil.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@theoplayer/yospace-connector-web": minor
---

Create ad break from advert start, if missing
7 changes: 7 additions & 0 deletions yospace/src/integration/YospaceAdHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ export class YospaceAdHandler {
this.advertStartListener = undefined;
}

if (this.currentAdBreak === undefined) {
const missingAdBreak = advert.broker.getAdBreakForAdvert(advert);
rbnbtns marked this conversation as resolved.
Show resolved Hide resolved
if (missingAdBreak !== undefined) {
this.currentAdBreak = this.getOrCreateAdBreak(missingAdBreak, true);
}
}

const ad = this.ads.get(advert);
if (ad !== undefined) {
this.currentAd = ad;
Expand Down
3 changes: 3 additions & 0 deletions yospace/src/yospace/AdBreak.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { YospaceSessionManager } from "./YospaceSessionManager";

export enum ResourceType {
STATIC,
HTML,
Expand Down Expand Up @@ -75,6 +77,7 @@ export interface AdvertEventHandler {

export interface Advert extends AdvertEventHandler {
addMacroSubstitution(key: string, value: string): void;
broker: YospaceSessionManager;
getAdType(): string;
getAdVerifications(): AdVerification[];
getCompanionAdsByType(type: ResourceType): CompanionCreative[];
Expand Down
3 changes: 3 additions & 0 deletions yospace/src/yospace/YospaceSessionManager.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { PlayerEvent } from './PlayerEvent';
import { TimedMetadata } from './TimedMetadata';
import { AnalyticEventObserver } from './AnalyticEventObserver';
import { AdVert, AdBreak } from './AdBreak';

export enum ResultCode {
CONNECTION_ERROR = -1,
Expand Down Expand Up @@ -28,6 +29,8 @@ export type YospaceSessionManagerCreator = {
};

export interface YospaceSession {
getAdBreakForAdvert(advert: AdVert): AdBreak | undefined;

getPlaybackMode(): PlaybackMode;

getPlaybackUrl(): string;
Expand Down