Skip to content
Closed
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"vite-plugin-dts": "^4.5.4"
},
"dependencies": {
"@shotstack/schemas": "1.11.0",
"@shotstack/schemas": "1.13.0",
"@shotstack/shotstack-canvas": "^2.9.0",
"howler": "^2.2.4",
"mediabunny": "^1.11.2",
Expand Down
7 changes: 5 additions & 2 deletions src/components/canvas/players/audio-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export class AudioPlayer extends Player {
const audioClipConfiguration = this.clipConfiguration.asset as AudioAsset;

const identifier = audioClipConfiguration.src;
if (!identifier) return;
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,8 +124,10 @@ export class AudioPlayer extends Player {
this.syncTimer = 0;

const audioAsset = this.clipConfiguration.asset as AudioAsset;
const loadOptions: pixi.UnresolvedAsset = { src: audioAsset.src, parser: AudioLoadParser.Name };
const audioResource = await this.edit.assetLoader.load<howler.Howl>(audioAsset.src, loadOptions);
const { src } = audioAsset;
if (!src) return;
const loadOptions: pixi.UnresolvedAsset = { src, parser: AudioLoadParser.Name };
const audioResource = await this.edit.assetLoader.load<howler.Howl>(src, loadOptions);

if (!(audioResource instanceof howler.Howl)) {
throw new Error(`Invalid audio source '${audioAsset.src}'.`);
Expand Down
1 change: 1 addition & 0 deletions src/components/canvas/players/image-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export class ImagePlayer extends Player {
private async loadTexture(): Promise<void> {
const imageAsset = this.clipConfiguration.asset as ImageAsset;
const { src } = imageAsset;
if (!src) return;

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

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
14 changes: 14 additions & 0 deletions src/components/timeline/media-thumbnail-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@ export class MediaThumbnailRenderer implements ClipRenderer {
const state: ThumbnailState = { loading: true, thumbnails: [], thumbnailWidth: 0, failed: false };
this.clipStates.set(clipKey, state);

if (!asset.src) {
state.loading = false;
state.failed = true;
this.onRendered();
return;
}

try {
const result = await this.generator.generateThumbnail(asset.src, asset.trim ?? 0);

Expand Down Expand Up @@ -155,6 +162,13 @@ export class MediaThumbnailRenderer implements ClipRenderer {
const state: ThumbnailState = { loading: true, thumbnails: [], thumbnailWidth: 0, failed: false };
this.clipStates.set(clipKey, state);

if (!asset.src) {
state.loading = false;
state.failed = true;
this.onRendered();
return;
}

try {
const result = await this.loadImageThumbnail(asset.src);

Expand Down
Loading