I am trying to add a video from cloudflare stream into my website. The code that cloudflare gives runs in html but when I paste the code in the html component of my angular project. I am getting the error -
Error: Template parse errors: 'stream' is not a known element: 1. If 'stream' is an Angular component, then verify that it is part of this module. 2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. (" [ERROR ->]
The code that works in html looks like this
<stream src="6aaee8579a7a************" autoplay muted preload></stream>
<script data-cfasync="false" defer="" type="text/javascript" src="https://embed.cloudflarestream.com/embed/r4xu.fla9.latest.js?video=6aaee8579a7a************"></script>
Now this is really a POC, and I myself dont really know angular, just trying to learn. Could someone please direct me to the correct material that I should look into to sort this?
You can do the following steps to add cloudflare stream to your Angular component:
1. Add the stream tags to your required component.
app.component.html
2. Now your
AppModule
(assuming your component belongs toAppModule
) should be like this:app.module.ts
3. Now add the cloudflare javascript library to your
index.html
You can find the working stackblitz demo here