Skip to content

Commit

Permalink
Merge pull request #12 from kionell/sb-video-encoding
Browse files Browse the repository at this point in the history
Encode storyboard video layer properly
  • Loading branch information
kionell authored Jun 26, 2023
2 parents f1cf646 + 74b01cf commit b8c2485
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/core/Encoders/Handlers/Beatmaps/BeatmapEventEncoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ export abstract class BeatmapEventEncoder {
encoded.push(`0,0,"${events.backgroundPath}",0,0`);
}

if (events.storyboard) {
encoded.push(StoryboardEventEncoder.encodeVideos(events.storyboard));
}

encoded.push('//Break Periods');

if (events.breaks && events.breaks.length > 0) {
Expand Down
17 changes: 17 additions & 0 deletions src/core/Encoders/Handlers/Storyboards/StoryboardEventEncoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,23 @@ export abstract class StoryboardEventEncoder {
return encoded.join('\n');
}

/**
* Encodes storyboard videos.
* @param storyboard A storyboard.
* @returns Encoded storyboard videos.
*/
static encodeVideos(storyboard: Storyboard): string {
const encoded: string[] = [];

const video = storyboard.getLayerByType(LayerType.Video);

if (video.elements.length > 0) {
encoded.push(this.encodeStoryboardLayer(video));
}

return encoded.join('\n');
}

/**
* Encodes a storyboard.
* @param storyboard The storyboard.
Expand Down

0 comments on commit b8c2485

Please sign in to comment.