videogular / videogular2

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

updatecue list like removecue method #727

Open pradeepchalla opened 6 years ago

pradeepchalla commented 6 years ago

Description

I have followed this demo https://videogular.github.io/videogular2-showroom/#/cue-points-player for adding cue points but i want to add update to the textracklist but i can not implement properly.

Expected Behavior

like removecue i have to do updatecue also so if i have added one cue list after that i want to update that same cue.

what i have tried

i have added one button to edit cue <button type="button" (click)="onClickUpdate(cue)">Update</button>

and then i did

onClickUpdate(cue: TextTrackCue) {
  const data = JSON.parse(cue.text);
  this.newCue.startTime = cue['startTime'];
  this.newCue.endTime = cue['endTime'];
  this.newCue.href = data['href'];
  this.newCue.src = data['src'];
  this.newCue.title = data['title'];
  this.newCue.description = data['description'];
}

i do not know how to proceed from this

please help me to solve this.

kwarismian commented 6 years ago

Rather than updating the data, have you considered removing the cue and adding a new one? It is generally better to treat data like this as immutable instead of mutating the data. It is possible that the only reason this isn't working for you is because your mutation is not triggering changes within Angular.