Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

audio play list #892

Open
dineshmaths1 opened this issue May 7, 2020 · 0 comments
Open

audio play list #892

dineshmaths1 opened this issue May 7, 2020 · 0 comments

Comments

@dineshmaths1
Copy link

I am working on audio play list . First audio complete After second audio url is changed but still playing first audio only .

This is my code


  <vg-player style="height:50px;" (onPlayerReady)="onPlayerReady($event)">
                            <vg-controls>
                                <vg-play-pause></vg-play-pause>
                                <vg-playback-button></vg-playback-button>

                                <vg-time-display vgProperty="current" vgFormat="mm:ss"></vg-time-display>

                                <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-time-display vgProperty="total" vgFormat="mm:ss"></vg-time-display>

                                <vg-mute></vg-mute>

                                <vg-fullscreen></vg-fullscreen>
                            </vg-controls>
                            <audio #media [vgMedia]="media" id="myAudio" preload="auto">
                                <source [src]="audio_url|audio:['pathToMedia']" [type]="'audio/mp3'">
                            </audio>

                        </vg-player>
  onPlayerReady(api: VgAPI) {
    this.api = api;

    this.api.getDefaultMedia().subscriptions.loadedMetadata.subscribe(this.playAudio.bind(this));
    this.api.getDefaultMedia().subscriptions.ended.subscribe(this.nextVideo.bind(this));
  }

  nextVideo() {
  
    this.currentIndex++;
    if (this.currentIndex === this.audio_source.length) {
      this.currentIndex = 0;
    }

    this.audio_url = this.audio_source[this.currentIndex];
    this.loadMedia(this.audio_url['uid']);
  }

  playAudio() {
    this.api.play();
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant