cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "iamjkdn (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CB-13467) cordova-plugin-media not playing from local URI
Date Thu, 19 Oct 2017 18:24:00 GMT
iamjkdn created CB-13467:
----------------------------

             Summary: cordova-plugin-media not playing from local URI
                 Key: CB-13467
                 URL: https://issues.apache.org/jira/browse/CB-13467
             Project: Apache Cordova
          Issue Type: Bug
          Components: cordova-plugin-media
         Environment: Android 6 on Redmi 4A
Building on Tabris JS
            Reporter: iamjkdn
            Priority: Critical


Trying to play audio files from the external storage of phone.

Went through [this plugin](https://stackoverflow.com/a/34378906/2096740) first finding the
URI for a particular mp3 file. Then passed that to the cordova-plugin-media instance.

{code:java}

// find music file URI from the sdcard
new ExternalStorageSdcardAccess( fileHandler ).scanPath( "file:///storage/C67A-18F7/Music/"
);
function fileHandler( fileEntry ) {
    // console.log( fileEntry.name + " | " + fileEntry.toURL() );
}    

// create a button instance
let mbutton = new Button({
  centerX: 0, top: [fbutton,100],
  text: 'play music'  
}).appendTo(ui.contentView);    

// call the play media function from the button
mbutton.on('select', () => {
    // load and play the music:
    playAudio("file:///storage/C67A-18F7/Music/demo/testSound.mp3")

});    

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.code + err.message);
        },
        // status callback
        function (status) {
            console.log("playAudio():Audio Status: " + status);
        }
    );
    // Play audio
    my_media.play();
    my_media.setVolume('1.0');
}
{code}


I checked the adb for log. This is what I got specifically hitting those buttons - [http://paste.ubuntu.com/25767292/](http://paste.ubuntu.com/25767292/)


{code:java}
incoming-operation: 'Call' on 'cordova.plugin' (o13) with method 'exec' with properties {action=create,
arguments=["d39113d0-b5f5-bf2d-8a84-5afbbc6ae9a0","file:///storage/C67A-18F7/Music/demo/testSound.mp3"],
callbackId=Media975330222}
incoming-operation: 'Call' on 'cordova.plugin' (o13) with method 'exec' with properties {action=startPlayingAudio,
arguments=["d39113d0-b5f5-bf2d-8a84-5afbbc6ae9a0","file:///storage/C67A-18F7/Music/demo/testSound.mp3",null],
callbackId=INVALID}
outgoing-operation: 'Notify' o13 of 'finish' with arguments {message=S01 Media975330222 s,
status=1, keepCallback=false, callbackId=Media975330222}
ExtMediaPlayer-JNI: env->IsInstanceOf fails
MediaPlayer-JNI: JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0
ExtMediaPlayer-JNI: env->IsInstanceOf fails
MediaPlayer-JNI: JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0

{code}





--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Mime
View raw message