hunk
V2EX  ›  问与答

react 下如何读取文件(arrarybuffer)给 video 控件播放?

  •  
  •   hunk · Mar 10, 2022 · 1557 views
    This topic created in 1637 days ago, the information mentioned may be changed or developed.
    react 下,想把读取文件的 arrarybuffer 给 video 控件播放,下面代码不成功,有用过的朋友吗?
    const blob = new Blob([data]);
    const src = URL.createObjectURL(data);
    const video = videoRef.current;
    video.src = src;
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   951 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 21:59 · PVG 05:59 · LAX 14:59 · JFK 17:59
    ♥ Do have faith in what you're doing.