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

preload metadata is not preloading tracks with local files - It works only on streaming #210

Open
garalimedkarim opened this issue Jan 2, 2019 · 1 comment

Comments

@garalimedkarim
Copy link

Hi everybody,

I'm working on an Ionic 3 App which playing both streaming and local files,
So, the play staff is "OK" but with local files the preload:"metadata" is not preloading my tracks (duration, etc ...),

I'm asking if there is a way to force preload for local files. Thanks

        let myPath = this.file.externalRootDirectory+track.fullPath.substr(1);
        let newTrack = {
          src: myPath,
          artist: 'John Mayer',
          title: "myTitle",
          preload: 'metadata'
        }
        this.myTracks.push(newTrack); 

For My Exemple it's playing, but not preloading data, So the data are not loaded until I click "play" for this track. :/ Can someone help me ?

@garalimedkarim
Copy link
Author

garalimedkarim commented Jan 8, 2019

Hey Community I found the solution, You have just to choose automatically, if the src of the track is a remote "https://...", if must be managed by "WebAudioProvider" in this case the duration will load correctly for remote, and for local files it must be managed by "CordovaMediaProvider" (the duration doesn't work until we click play but it isn't a big matter )

So, the conclusion the provider must be used automatically depending on track ( streaming | local )

export function defaultAudioProviderFactory() {
    return window.hasOwnProperty('cordova') && window.hasOwnProperty('Media') ? new CordovaMediaProvider() : new WebAudioProvider();
}

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

1 participant