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

Video tag is only working with iFrame. it's not working with <video> tag in reactjs and also It's not supported some extension like .mov #1003

Open
akansha-simform opened this issue Sep 11, 2024 · 0 comments

Comments

@akansha-simform
Copy link

When uploading videos from my computer, I'm limited to .mp4 files and the "video" type. If I try to upload .mov or other video file extensions, they're not uploaded but instead downloaded directly.

To address this issue, I need to use a

I've implemented this customVideoBlot code:

import Quill from 'quill';
const BlockEmbed = Quill.import('blots/block/embed');

class VideoBlot extends BlockEmbed {
  static blotName = 'video';
  static tagName = 'video';  // Use video tag

static create(url) {
    let node = super.create();
    node.setAttribute('src', url);   // Set video source
    node.setAttribute('controls', true);  // Add controls to video
    node.setAttribute('width', '100%');  // You can set default width/height if needed
    node.setAttribute('height', 'auto');
    return node;
  }

static formats(node) {
    let format = {};
    if (node.hasAttribute('height')) {
      format.height = node.getAttribute('height');
    }
    if (node.hasAttribute('width')) {
      format.width = node.getAttribute('width');
    }
    return format;
  }

static value(node) {
    return node.getAttribute('src');
  }

format(name, value) {
    if (name === 'height' || name === 'width') {
      if (value) {
        this.domNode.setAttribute(name, value);
      } else {
        this.domNode.removeAttribute(name);
      }
    } else {
      super.format(name, value);
    }
  }
}

Quill.register(VideoBlot);
@akansha-simform akansha-simform changed the title Video tag if only working with iFrame. it's not working with <video> tag in reactjs Video tag is only working with iFrame. it's not working with <video> tag in reactjs and also It's not supported some extension like .mov Sep 17, 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