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

Fix: manage images with relative path in iframe #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nicolas-daures
Copy link
Member

This PR fixes an issue with the images with relative path in iframe.

Description

Images with relative path in iframe are not displayed because they do not contain the iframe domain.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Enhancement (changes that improvement of current feature or performance)
  • Refactoring (changes that neither fixes a bug nor adds a feature)
  • Test Case (changes that add missing tests or correct existing tests)
  • Code style optimization (changes that do not affect the meaning of the code)
  • Docs (changes that only update documentation)
  • Chore (changes that don't modify src or test files)

Self Check before Merge

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@nicolas-daures nicolas-daures self-assigned this Mar 1, 2024
Copy link

@mikaelkurek mikaelkurek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the image sources in a web-browser, I agree. But I have some questions about the other changes.

Comment on lines +125 to +129
// Keep only visible elements and delete source tags
children = children.filter(
(child) => child.style == null || child.style.display !== 'none',
(child) =>
(child.style == null || child.style.display !== 'none') &&
(child.tagName == null || child.tagName.toLowerCase() !== 'source'),
Copy link

@mikaelkurek mikaelkurek Mar 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why deleting source tags ? What will happen to a video with source tags ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The library relies on the video tag to generate the snapshot, not on the source tags. For the moment, I don't know why the source tag is causing a problem and preventing the image from displaying correctly.

clonedNode.onload = resolve
clonedNode.onerror = reject
clonedNode.onerror = resolve

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the changes we've made, an error can occur ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so: image not found, CORS, ...

Copy link

@mikaelkurek mikaelkurek Mar 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be detected before with the fetchAsDataURL, done when requesting image. I don't think it can happens now with our changes in the player (the imagePlaceholder option set)

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

Successfully merging this pull request may close these issues.

2 participants