我想让cloudflare流以角度工作。我尝试了这里给出的解决方案:Angular attribute for HTML stream。
然而,这始终是一次成功或失败:
<stream>标记进行更改,并且重新编译角时,播放机就会被加载。在此之后,如果我刷新浏览器,它又是一个空白屏幕.显示视频的组件在树中很深,并且该组件属于延迟加载的模块:
在index.html文件中:
<!doctype html>
<html lang="en">
<head>
...............
</head>
<body>
<app-root></app-root>
</body>
<script src="https://embed.cloudflarestream.com/embed/r4xu.fla9.latest.js" id="video_embed" defer="" async=""></script>
</html>在videoFile.component.ts中:
<stream src="5d5bc37ffcf54c9b82e996823bffbb81" height="480px" width="240px" controls></stream>发布于 2020-02-16 10:46:52
在这里找到了一个解决方案:https://github.com/angular/angular/issues/13965
因此,每次加载组件时,都会使用ngOninit删除和重新附加脚本,如下所示:
document.getElementById("video_embed").remove();
let testScript = document.createElement("script");
testScript.setAttribute("id", "video_embed");
testScript.setAttribute("src", "https://embed.cloudflarestream.com/embed/r4xu.fla9.latest.js");
document.body.appendChild(testScript);如果有人有其他解决办法,请告诉我。
https://stackoverflow.com/questions/60247000
复制相似问题