Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Annotations not Displaying on Video #52

Open
nilu2039 opened this issue Mar 2, 2024 · 0 comments
Open

Issue with Annotations not Displaying on Video #52

nilu2039 opened this issue Mar 2, 2024 · 0 comments

Comments

@nilu2039
Copy link

nilu2039 commented Mar 2, 2024

Description

I'm encountering an issue while using the PDFTron WebViewer in conjunction with video annotations.

Steps to Reproduce

  1. Use the webviewer-video-sample repository from GitHub (https://github.com/PDFTron/webviewer-video-sample) to integrate video annotations into an application.
  2. Export annotations using the following code snippet:
const { instance } = state;
instance.Core.annotationManager.exportAnnotations().then((xfdfString) => {
    console.log(xfdfString);
});
  1. Load annotations using a similar code snippet:
documentViewer.addEventListener("documentLoaded", async () => {
    const xfdfString = ANNOTATION;
    await annotationManager.importAnnotations(xfdfString);
});

Note that the annotations are visible in the right panel, but they are not displayed on the video itself.
Clicking on one of the annotations in the right panel triggers the error message: addRange(): The given range isn't in document.

Expected Behavior

Annotations should be displayed on the video itself, and clicking on annotations should not trigger any errors.

Actual Behavior

Annotations are not displayed on the video, and clicking on annotations triggers the error message: addRange(): The given range isn't in document.

Additional Information

I also experimented with the code snippet provided in the PDFTron documentation, which sets the document's XFDF retriever as shown below:

documentViewer.setDocumentXFDFRetriever(async () => {
    const response = await fetch('path/to/annotation/server');
    const xfdfString = await response.text();
    return xfdfString;
});

However, this approach did not yield the desired results either.

And the default implement is also not working(this does not even show the annotation in right panel)

if (process.env.DEMO) {
        const { documentViewer } = instance.Core;
        const annotManager = documentViewer.getAnnotationManager();
        // Load saved annotations
        documentViewer.addEventListener(
          'videoElementReady',
          async () => {
            const video = videoInstance.getVideo();
            const xfdfString = demoXFDFString;
            await annotManager.importAnnotations(xfdfString);
            video.updateAnnotationsToTime(0);
          },
          { once: true },
        );
}

Environment

  • @pdftron/webviewer: ^10.3.0
  • @pdftron/webviewer-video: ^4.35.4
  • @pdftron/webviewer-audio: ^2.21.4
  • Chrome: 122.0.6261.69 (Official Build) (arm64)

Demo video

Screen.Recording.2024-03-02.at.6.23.17.PM.mov
@nilu2039 nilu2039 changed the title Issue with Annotations not Displaying on Video in PDFTron WebViewer Issue with Annotations not Displaying on Video Mar 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant