PhoneGap Cordova Media Plugin - How to integrate/install?

user1419601

I have been searching everywhere and trying everything, but I just can't seem to be able to use cordova's Media plugin. (e.g var sound = new Media("sound.mp3"); )

I've tried everything and can't seem to get it to work. Please put me out of my misery and give me a step by step instruction on how to do this. I have android sdk and gethub installed already along with a bunch of other things.

Most of the things I see are, " Installation: cordova plugin add cordova-plugin-media" THATS IT. Specially the ones with the stupid $ symbol which is completely unrecognized.

..thank you in advance :(

Amin

At first double check your work: Step1, Step2 Then, to add media plugin to your project you need to:

(in app/res/xml/config.xml)
<feature name="Media">
    <param name="android-package" value="org.apache.cordova.media.AudioHandler" />
</feature>


(in app/AndroidManifest.xml)
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

More info

And this is a code sample of how to use it (source)

// Play audio
//
function playAudio(url) {
    // Play the audio file at url
    var my_media = new Media(url,
        // success callback
        function () {
            console.log("playAudio():Audio Success");
        },
        // error callback
        function (err) {
            console.log("playAudio():Audio Error: " + err);
        }
    );
    // Play audio
    my_media.play();
}

Finally, you can call the playAudio('path/to/file.mp3') function within your code (after device got ready).

document.addEventListener("deviceready", onDeviceReady, false);

function onDeviceReady() {
    console.log(Media);
    /* call function here */
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

PhoneGap Cordova Media Plugin - How to integrate/install?

From Dev

phoneGap/Apache Cordova media capture plugin - multiple video recording

From Dev

How to update cordova (phonegap) plugin in my project?

From Dev

How to create Cordova iOS Phonegap Plugin (Swift)?

From Dev

Cordova Media Plugin

From Dev

How to add a cordova plugin to meteor that isn't in the phonegap registry?

From Dev

PouchDB + SQLite plugin for Cordova/PhoneGap

From Dev

install a phonegap plugin in a cordova project

From Dev

Phonegap/Cordova Touch Id Plugin

From Dev

Cordova Media Plugin setVolume() not working

From Dev

Phonegap local builds fail with media plugin

From Dev

Phonegap media plugin one sound at time

From Dev

Cordova/Phonegap iOS Parse-Push Plugin

From Dev

Cordova WKWebView Plugin with PhoneGap Build Version 6.0.0

From Dev

Cordova/Phonegap Plugin - Android - Session was closed properly

From Dev

Ionic, cordova, phonegap, jquery Bluetooth plugin

From Dev

Not able to add Plugin to phonegap Cordova 3.1.0

From Dev

Phonegap/cordova plugin not fired on remote website

From Dev

Cordova/Phonegap Facebook Plugin Example/Best Practices

From Dev

Cordova/Phonegap Plugin - Android - Session was closed properly

From Dev

Is there any video cutter plugin for cordova phonegap?

From Dev

Cordova Google Maps Plugin Installation For Phonegap

From Dev

Cordova/Phonegap: Can't get Facebook Phonegap plugin to work

From Dev

Upload Recording from Cordova Media Plugin

From Dev

Cordova plugin media capture error 20

From Dev

Stop All Audio Cordova Media Plugin?

From Dev

Cordova Media Plugin doesn't implement audioPlayerEndInterruption

From Dev

Adding cordova plugin media-capture to meteor

From Dev

cordova media plugin. continue recording of existing

Related Related

  1. 1

    PhoneGap Cordova Media Plugin - How to integrate/install?

  2. 2

    phoneGap/Apache Cordova media capture plugin - multiple video recording

  3. 3

    How to update cordova (phonegap) plugin in my project?

  4. 4

    How to create Cordova iOS Phonegap Plugin (Swift)?

  5. 5

    Cordova Media Plugin

  6. 6

    How to add a cordova plugin to meteor that isn't in the phonegap registry?

  7. 7

    PouchDB + SQLite plugin for Cordova/PhoneGap

  8. 8

    install a phonegap plugin in a cordova project

  9. 9

    Phonegap/Cordova Touch Id Plugin

  10. 10

    Cordova Media Plugin setVolume() not working

  11. 11

    Phonegap local builds fail with media plugin

  12. 12

    Phonegap media plugin one sound at time

  13. 13

    Cordova/Phonegap iOS Parse-Push Plugin

  14. 14

    Cordova WKWebView Plugin with PhoneGap Build Version 6.0.0

  15. 15

    Cordova/Phonegap Plugin - Android - Session was closed properly

  16. 16

    Ionic, cordova, phonegap, jquery Bluetooth plugin

  17. 17

    Not able to add Plugin to phonegap Cordova 3.1.0

  18. 18

    Phonegap/cordova plugin not fired on remote website

  19. 19

    Cordova/Phonegap Facebook Plugin Example/Best Practices

  20. 20

    Cordova/Phonegap Plugin - Android - Session was closed properly

  21. 21

    Is there any video cutter plugin for cordova phonegap?

  22. 22

    Cordova Google Maps Plugin Installation For Phonegap

  23. 23

    Cordova/Phonegap: Can't get Facebook Phonegap plugin to work

  24. 24

    Upload Recording from Cordova Media Plugin

  25. 25

    Cordova plugin media capture error 20

  26. 26

    Stop All Audio Cordova Media Plugin?

  27. 27

    Cordova Media Plugin doesn't implement audioPlayerEndInterruption

  28. 28

    Adding cordova plugin media-capture to meteor

  29. 29

    cordova media plugin. continue recording of existing

HotTag

Archive