Skip to content

Commit

Permalink
fix(handlemedia): plyr should work with internal embeds with hash now
Browse files Browse the repository at this point in the history
  • Loading branch information
aidenlx committed May 15, 2021
1 parent 86a5a2a commit 078f807
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/modules/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export function handleLink(
linktext,
ctx.sourcePath,
);
if (!matchedFile) return;
if (!matchedFile) throw new Error("No file found for link: " + linktext);

workspace.iterateAllLeaves((leaf) => {
if (leaf.view instanceof FileView && leaf.view.file === matchedFile)
Expand Down Expand Up @@ -166,7 +166,7 @@ export async function handleMedia(
throw new TypeError("src not found on container <span>");
}

const { setPlayerTF, setHashOpt } = getSetupTool(srcLinktext);
const { linktext, setPlayerTF, setHashOpt } = getSetupTool(srcLinktext);

if (!(span.firstElementChild instanceof HTMLMediaElement)) {
console.error("first element not player: %o", span.firstElementChild);
Expand Down Expand Up @@ -202,9 +202,11 @@ export async function handleMedia(
}

const videoFile = plugin.app.metadataCache.getFirstLinkpathDest(
span.getAttr("src") as string,
linktext,
ctx.sourcePath,
);
if (!videoFile) throw new Error("No file found for link: " + linktext);

const tracks = await getSubtitleTracks(videoFile, plugin);

const srcMediaEl = span.firstElementChild;
Expand Down

0 comments on commit 078f807

Please sign in to comment.