Skip to content
This repository has been archived by the owner on Dec 28, 2022. It is now read-only.

How to controll multiple videos? with or without custom control #91

Open
naonvl opened this issue Aug 12, 2021 · 1 comment
Open

How to controll multiple videos? with or without custom control #91

naonvl opened this issue Aug 12, 2021 · 1 comment

Comments

@naonvl
Copy link

naonvl commented Aug 12, 2021

image

i want to create a multiple player controls by one video or a custom controls, i manage to control play pause and stop but how do i control if user did seeking? i tried seeking and seeked but i think i use it wrong, here's how i implement customcontrol

  play(): void {
    this.isPlayed = true;
    this.plyr.toArray().forEach(plyr => plyr.player.play());
  }
seeking(): void {
   // IF USER SEEKING
 }
  seeked(event: Plyr.PlyrEvent) {
    this.seeking()
  }

How can i do that?

@metsehaf
Copy link

metsehaf commented Aug 4, 2022

@naonvl , this is how I did it for multiple players,

In your html you can pass the index of your selected video and seek like this
`


<button (click)="play(k)">Play
<button (click)="stop(k)">Stop
<button id="btnSeek" (click)="selectToThirty(k)">Seek 30
<button id="btnSeek" (click)="selectToSixty(k)">Seek 60
<button id="btnSeek" (click)="selectToNinety(k)">Seek 90



` so in your component.ts, you can't really call a seek function cause it doesn't exist, but you can set the current time by specifiying or assigning it

` selectToThirty(i: number) {
this.playerList[i].player.currentTime = 30;
this.play(i);
}

selectToSixty(i: number) {
this.playerList[i].player.currentTime = 60;
this.play(i);
}

selectToNinety(i: number) {
this.playerList[i].player.currentTime = 90;
this.play(i);
}
`

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants