Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

View not refreshing [Media]

$
0
0

@Mystearica wrote:

I’m using the Media plugin to play some audios.

When the audio has the status of running or playing, i change the property init to change the name of the icon i want to display.

It works the first time i click, changes the icon to “pause”.

But when the audio changes the status to stopped, or the audio just finished, even if i can see in the logs, that object changed correctly the value, in the view never happens, and I’m going crazy because I dont’ understand why its not working.

 this.file = this.media.create(url);
        this.file.play();
        this.file.onStatusUpdate.subscribe(status => {
          console.log("AUDIO STATUS", status);
          if (status == 1 || status == 2) {
            this.chistesFiltered[i].init = "pause"
          }
          if (status == 4) {
            this.chistesFiltered[i].init = "play"
            console.log("item", item)
          }
        })

        this.file.onSuccess.subscribe(() => {
          console.log("Audio Completed");
          console.log("item2", this.chistesFiltered[i].init)
          this.chistesFiltered[i].init = "play";
          this.file.release();


        });

Also this is my view

I have an ngFor, the alias for the array its “item”

   <ion-col col-3 center text-center>
          <button ion-button large round (click)="playPause(item,i)">
            <ion-icon name="{{item.init}}"></ion-icon>
          </button>
   </ion-col>

Thanks all.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>