Skip to content
Open
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
6 changes: 6 additions & 0 deletions src/components/canvas/players/audio-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ export class AudioPlayer extends Player {
const audioClipConfiguration = this.clipConfiguration.asset as AudioAsset;

const identifier = audioClipConfiguration.src;
if (!identifier) {
throw new Error("Audio asset is missing a 'src'.");
}
const loadOptions: pixi.UnresolvedAsset = { src: identifier, parser: AudioLoadParser.Name };
const audioResource = await this.edit.assetLoader.load<howler.Howl>(identifier, loadOptions);

Expand Down Expand Up @@ -123,6 +126,9 @@ export class AudioPlayer extends Player {
this.syncTimer = 0;

const audioAsset = this.clipConfiguration.asset as AudioAsset;
if (!audioAsset.src) {
throw new Error("Audio asset is missing a 'src'.");
}
const loadOptions: pixi.UnresolvedAsset = { src: audioAsset.src, parser: AudioLoadParser.Name };
const audioResource = await this.edit.assetLoader.load<howler.Howl>(audioAsset.src, loadOptions);

Expand Down
3 changes: 3 additions & 0 deletions src/components/canvas/players/image-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ export class ImagePlayer extends Player {
private async loadTexture(): Promise<void> {
const imageAsset = this.clipConfiguration.asset as ImageAsset;
const { src } = imageAsset;
if (!src) {
throw new Error("Image asset is missing a 'src'.");
}

const corsUrl = `${src}${src.includes("?") ? "&" : "?"}x-cors=1`;
const loadOptions: pixi.UnresolvedAsset = { src: corsUrl, crossorigin: "anonymous", data: {} };
Expand Down
3 changes: 3 additions & 0 deletions src/components/canvas/players/video-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ export class VideoPlayer extends Player {
private async loadVideo(): Promise<void> {
const videoAsset = this.clipConfiguration.asset as VideoAsset;
const { src } = videoAsset;
if (!src) {
throw new Error("Video asset is missing a 'src'.");
}

if (src.endsWith(".mov")) {
throw new Error(`Video source '${src}' is not supported. .mov files cannot be played in the browser. Please convert to .webm or .mp4 first.`);
Expand Down
12 changes: 10 additions & 2 deletions src/components/timeline/media-thumbnail-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ export class MediaThumbnailRenderer implements ClipRenderer {
this.clipStates.set(clipKey, state);

try {
const result = await this.generator.generateThumbnail(asset.src, asset.trim ?? 0);
const { src } = asset;
if (!src) {
throw new Error("Video asset is missing a 'src'.");
}
const result = await this.generator.generateThumbnail(src, asset.trim ?? 0);

// Check if element is still in DOM (might have been disposed)
if (!element.isConnected) return;
Expand Down Expand Up @@ -156,7 +160,11 @@ export class MediaThumbnailRenderer implements ClipRenderer {
this.clipStates.set(clipKey, state);

try {
const result = await this.loadImageThumbnail(asset.src);
const { src } = asset;
if (!src) {
throw new Error("Image asset is missing a 'src'.");
}
const result = await this.loadImageThumbnail(src);

// Check if element is still in DOM (might have been disposed)
if (!element.isConnected) return;
Expand Down
Loading