Skip to content

Commit

Permalink
Merge pull request #56 from THEOplayer/bugfix/yospace-missing-ad-events
Browse files Browse the repository at this point in the history
Bugfix/yospace missing ad events
  • Loading branch information
rbnbtns authored Nov 5, 2024
2 parents 524ab16 + 2ab9fe2 commit 9931d8d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
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);
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

0 comments on commit 9931d8d

Please sign in to comment.