@cloudflare/stream-angular
Official Angular component for Cloudflare Stream.
Installation
``sh
yarn add @cloudflare/stream-angular
`
Usage
app.module.ts
`ts
import { BrowserModule } from "@angular/platform-browser";
import { NgModule } from "@angular/core";
import { CloudflareStreamModule } from "@cloudflare/stream-angular";
import { AppComponent } from "./app.component";
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, CloudflareStreamModule],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule {}
`
app.component.html
`html
[controls]="true"
src="644822f93dcddab3e9441587d184ca2f"
>
`
API
`ts
@Component({
selector: "cloudflare-stream",
// ...
})
export class CloudflareStreamComponent {
// ...
/**
* URL to a VAST advertising tag. If specified, the player will attempt to display ads speficied by the VAST ad schema.
*/
@Input() adUrl: string;
/**
* Tells the browser to immediately start downloading the video and play it as soon as it can. Note that mobile browsers generally do not support this attribute, the user must tap the screen to begin video playback. Please consider mobile users or users with Internet usage limits as some users don’t have unlimited Internet access before using this attribute.
*
* To disable video autoplay, the autoplay attribute needs to be removed altogether as this attribute. Setting autoplay="false" will not work; the video will autoplay if the attribute is there in the tag.
*
* In addition, some browsers now prevent videos with audio from playing automatically. You may add the mute attribute to allow your videos to autoplay. For more information, go here.
*/
@Input() autoplay: boolean;
/**
* Shows the default video controls such as buttons for play/pause, volume controls. You may choose to build buttons and controls that work with the player.
*/
@Input() controls: boolean;
/**
* Returns the current playback time in seconds. Setting this value seeks the video to a new time.
*/
@Input() currentTime: number;
/**
* The height of the video’s display area, in CSS pixels.
*/
@Input() height: string;
/**
* A Boolean attribute; if included the player will automatically seek back to the start upon reaching the end of the video.
*/
@Input() loop: boolean;
/**
* A Boolean attribute which indicates the default setting of the audio contained in the video. If set, the audio will be initially silenced.
*/
@Input() muted: boolean;
/**
* A URL for an image to be shown before the video is started or while the video is downloading. If this attribute isn’t specified, a thumbnail image of the video is shown.
*/
@Input() poster: string;
/**
* This enumerated attribute is intended to provide a hint to the browser about what the author thinks will lead to the best user experience. You may choose to include this attribute as a boolean attribute without a value, or you may specify the value preload="auto" to preload the beginning of the video. Not including the attribute or using preload="metadata" will just load the metadata needed to start video playback when requested.
*
* The