Skip to content

Commit

Permalink
revert: bumperAssetId shortcode
Browse files Browse the repository at this point in the history
  • Loading branch information
matvp91 committed Sep 12, 2024
1 parent 3d5153d commit e625f7e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
7 changes: 5 additions & 2 deletions packages/stitcher/src/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import base64 from "hi-base64";
const c = initContract();

const sessionParams = z.object({
vmapUrl: z.string().optional(),
vmap: z
.object({
url: z.string(),
})
.optional(),
interstitials: z
.array(
z.object({
Expand All @@ -15,7 +19,6 @@ const sessionParams = z.object({
}),
)
.optional(),
bumperAssetId: z.string().optional(),
maxResolution: z.coerce.number().optional(),
});

Expand Down
18 changes: 5 additions & 13 deletions packages/stitcher/src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ const PlaylistUnavailableError = createError<[string]>(

export async function createSession(data: {
assetId: string;
vmapUrl?: string;
vmap?: {
url: string;
};
interstitials?: Interstitial[];
bumperAssetId?: string;
maxResolution?: number;
}) {
if (!(await isAssetAvailable(data.assetId))) {
Expand All @@ -39,8 +40,8 @@ export async function createSession(data: {

const interstitials: Interstitial[] = [];

if (data.vmapUrl) {
const vmap = await getVmap(data.vmapUrl);
if (data.vmap) {
const vmap = await getVmap(data.vmap.url);

for (const adBreak of vmap.adBreaks) {
interstitials.push(
Expand All @@ -53,15 +54,6 @@ export async function createSession(data: {
interstitials.push(...data.interstitials);
}

// When we have a bumper, we'll push it at the end of the interstitials list.
if (data.bumperAssetId) {
interstitials.push({
timeOffset: 0,
assetId: data.bumperAssetId,
type: "bumper",
});
}

let maxResolution = data.maxResolution;
if (!maxResolution) {
const MAX_RESOLUTION_8K = 4320;
Expand Down

0 comments on commit e625f7e

Please sign in to comment.