videogular / videogular2

The HTML5 video player for Angular 2
https://videogular.github.io/videogular2-showroom/#/
MIT License
672 stars 211 forks source link

this.api.playbackRate isn't setting default video playback rate #884

Closed ghost closed 4 years ago

ghost commented 4 years ago

smart-playlist.component.html

`<vg-player (onPlayerReady)="onPlayerReady($event)">

<vg-buffering></vg-buffering>
<vg-controls>
    <vg-play-pause></vg-play-pause>
    <vg-scrub-bar>
        <vg-scrub-bar-current-time></vg-scrub-bar-current-time>
        <vg-scrub-bar-buffering-time></vg-scrub-bar-buffering-time>
    </vg-scrub-bar>
    <vg-time-display vgProperty="left" vgFormat="mm:ss"></vg-time-display>
    <vg-playback-button></vg-playback-button>
    <vg-quality-selector *ngIf="bitrates" (onBitrateChange)="setBitrate($event)" [bitrates]="bitrates">
    </vg-quality-selector>
    <vg-mute></vg-mute>
    <vg-volume></vg-volume>
    <vg-fullscreen></vg-fullscreen>
</vg-controls>
<video
    #media
    (onGetBitrates)="bitrates = $event"
    [vgMedia]="media"
    [vgHls]="currentStream.source"
    id="singleVideo"
    preload="auto"
    crossorigin
>
</video>

` smart-playlist.component.ts `import {Component, OnInit, ViewChild} from '@angular/core'; import {BitrateOption, VgAPI} from 'videogular2/compiled/core'; import {timer} from 'rxjs'; import {Subscription} from 'rxjs'; import {IDRMLicenseServer} from 'videogular2/compiled/streaming'; import {VgDASH} from 'videogular2/compiled/src/streaming/vg-dash/vg-dash'; import {VgHLS} from 'videogular2/compiled/src/streaming/vg-hls/vg-hls'; export interface IMediaStream { type: 'vod' | 'dash' | 'hls'; source: string; label: string; token?: string; licenseServers?: IDRMLicenseServer; } @Component({ selector: 'app-smart-playlist', templateUrl: './smart-playlist.component.html', styleUrls: ['./smart-playlist.component.css'] }) export class SmartPlaylistComponent implements OnInit { @ViewChild(VgDASH, {static: false}) vgDash: VgDASH; @ViewChild(VgHLS, {static: false}) vgHls: VgHLS; currentStream: IMediaStream; api: VgAPI; bitrates: BitrateOption[]; streams: IMediaStream[] = [ { type: 'hls', label: 'HLS: Streaming', source: 'https://d2zihajmogu5jn.cloudfront.net/bipbop-advanced/bipbop_16x9_variant.m3u8' } ]; constructor() {} ngOnInit() { this.currentStream = this.streams[0]; } onPlayerReady(api: VgAPI) { this.api = api; **this.api.playbackRate = 2;** } setBitrate(option: BitrateOption) { this.vgHls.setBitrate(option); } onClickStream(stream: IMediaStream) { this.api.pause(); this.bitrates = null; const leTimer: Subscription = timer(0, 10).subscribe(() => { this.currentStream = stream; leTimer.unsubscribe(); }); } } ` Using "this.api.playbackRate = 2;" isn't properly setting the playback rate to 2 on player ready,. Have i missed something here?
ghost commented 4 years ago

sorry, i was having issues with embedding the code... rewrote this issue with image links to the component .ts and .html - this issue can be deleted.