Cordova Media plugin constructor fails

192 Views Asked by At

I'm creating a kind of media player with Cordova Media plugin. I'm Using cordova in combination with Vue JS to create a mobile application.

What i'm doing is, i try to create a new Media with a source and when i click on forward, so we want another song, i try to replace the source of the Media Variable. But it gave me an error.

What i just want i to play the next song that i have defined somewhere in a array.

      Media = new Media(responsePendingPodcasts.data.data[0].file);

This is what i have called the first time. The second time i try to run this code:

    Media.stop();
    Media.release();
    Media = new Media(state.podcastsPending[newIndex].file);

But this gave me an error.

Unhandled Promise Rejection: TypeError: Media is not a constructor (evaluating 'new Media(state.podcastsPending[newIndex].file)')

I hope someone can help me. I just want to play the next song.

Cordova-plugin-media version 5.0.2

0

There are 0 best solutions below