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

Can't play again #185

Open
zhudingshibai opened this issue Mar 7, 2018 · 7 comments
Open

Can't play again #185

zhudingshibai opened this issue Mar 7, 2018 · 7 comments

Comments

@zhudingshibai
Copy link

I an using this for an ionic app. The mp3 file can only play once .

this is the console.log messages:

  1. play
    Loading track http:///APP/DonkeyDonkey.mp3
    Playing audio sample 'http://
    /APP/DonkeyDonkey.mp3'
    Playing stream with AVPlayer & default rate
    Playing track http:///APP/DonkeyDonkey.mp3
    Finished playback
    Track finished
    Media with id 1e10e9b5-6b8e-b325-379f-e45b8377ff7d released
    Released track http://
    /APP/DonkeyDonkey.mp3

  2. play again:
    Loading track http:///APP/DonkeyDonkey.mp3
    Will use resource 'http://
    /APP/DonkeyDonkey.mp3' from the Internet.
    Audio error => track http:///APP/DonkeyDonkey.mp3 [object Object]
    Loading track http://
    /APP/DonkeyDonkey.mp3
    Audio error => track http://***/APP/DonkeyDonkey.mp3 [object Object]


config:

from.tracks = [{
src: 'http://***' + encodeURI(from.arr_people.audio),
artist: '',
title: '',
art: '',
preload: 'metadata'
}];


HTML :
<audio-track #audio *ngFor="let track of tracks" [track]="track" (onFinish)="onTrackFinished($event)">
<ion-item style="background-color:rgb(117, 165, 236)" [hidden]='!playing'>

<audio-track-play dark [audioTrack]="audio">




<audio-track-progress-bar dark duration progress [audioTrack]="audio" [ngStyle]="{visibility: audio.completed > 0 ? 'visible' : 'hidden'}">


@arielfaur
Copy link
Owner

Are you using the cordova plugin Media?

@zhudingshibai
Copy link
Author

zhudingshibai commented Mar 7, 2018

"cordova-plugin-media": "^3.0.1",
"cordova-plugin-streaming-media": "^1.0.2",

I installed those two .

It's a bug of cordova plugin Media ?

@zhudingshibai
Copy link
Author

I use WebAudioProvider now.

It can play again, but can't display pause and play button, it always refreshing...

@arielfaur
Copy link
Owner

Hmm it is hard to tell, it worked fine when I tested it back then. I will try to look into it whenever I find some spare time.

@codinronan
Copy link

codinronan commented Apr 21, 2018

cordova-plugin-media releases the track when they complete, even if ionic-audio doesn't. The simple solution is to just delete and re-create the track from the same source data once it completes. Most modern browsers will still have the entire song cached so you lose nothing in performance.

@arielfaur
Copy link
Owner

@codinronan That makes sense and explains why so many people are reporting the same issues. There are so many different use cases that it is hard to find one approach that works for all.

@saumya04
Copy link

saumya04 commented Oct 1, 2018

@codinronan Can you let me know how can I recreate the audio track after the track is released by the plugin. I mean which method to use to re-create it again?

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

4 participants