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

Ionic 4 detect when html 5 audio player starts playing

$
0
0

@alex001 wrote:

Hi,
I have a number of audio files loaded on page similar to how it is written below:

<ion-item *ngFor="let programme of radioProgrammes" class="radio-file">
              <audio controls preload>
                <source [src]="programme.radio_file" type="audio/mpeg">
                Your device does not support the audio element.
              </audio>
</ion-item>

The issue is I want to stop the user from playing more than 1 audio file at a time.

I have already written a function pause all other audio files if they are playing but but I cant figure out how to detect when the file starts playing.

I originally tried adding (click)=“pauseOtherPlayers()” to call the function eg:

 <audio (click)="pauseOtherPlayers()" controls preload>
                <source [src]="programme.radio_file" type="audio/mpeg">
                Your device does not support the audio element.
</audio>

but that didn’t work.

Thanks in advanced to anyone who can help me with this issue.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70927

Trending Articles



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