1. #1
    Sencha User
    Join Date
    May 2012
    Posts
    13
    Vote Rating
    0
    tech-study is on a distinguished road

      0  

    Default Unanswered: Playing audio on Android native

    Unanswered: Playing audio on Android native


    My audio files does not play on android v2.3.3. I guess as I am using local audio files there is some issue.
    My audio files are in the sdk/resources/data/audio dir. To play the audio files I am detecting the environment & prefixing the url with: 'file:///android_asset/www/' but to no avail.

    Can someone help?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,074
    Answers
    3500
    Vote Rating
    854
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Is the audio file present after a build and package?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    May 2012
    Posts
    13
    Vote Rating
    0
    tech-study is on a distinguished road

      0  

    Default


    Yeah the audio file does exist. Is there an auto-play issue with sencha audio in Android?
    I still haven't found a fix on it.

  4. #4
    Sencha User
    Join Date
    Nov 2012
    Posts
    1
    Vote Rating
    0
    cutebokchoi is on a distinguished road

      0  

    Default In the DDMS - getting mediaPlayer error after StageFrightPlayer setdatasource

    In the DDMS - getting mediaPlayer error after StageFrightPlayer setdatasource


    I am getting an audio playing issue for my app built in sencha 2.1 for api level 10. Mediaplayer errors galore.

    In the DDMS the setDataSource is going to:
    file:///android_asset/resources/audio/one.mp3 which is correct.

    Straight after the setdatasource in StageFrightPlayer it gives a MediaPlayer error (1, -2147483648)

    so strange. Don't know what else I can try. It works fine in the chrome browser.

  5. #5
    Sencha User
    Join Date
    Oct 2013
    Posts
    7
    Vote Rating
    0
    lexan1982 is on a distinguished road

      0  

    Default


    I had some MediaPlayer errors on Android when use .mp3 file with duration less then one second( I want click button sound).

    When I change sound(for example I load sound with duration 1.1 second) - it start play normally.

    P.S. and I use this IF:
    Code:
     
    if (Ext.os.is('Android')){
    
           audioPath='/android_asset/www/' + audioFileName;
    }

  6. #6
    Sencha User
    Join Date
    Oct 2013
    Posts
    3
    Vote Rating
    0
    MakeSourceCode is on a distinguished road

      0  

    Default


    Hi,

    in my project using Sencha Touch and Phonegap. I have tried to use Phonegap Media Plugin in Sencha Touch for reproduce a local file audio, but does not works.
    This is my code:

    index.html:

    Code:
    <html>
    <head>
        <meta charset="UTF-8">
        <title>ApplicationName</title>
        <script type="text/javascript" src="../cordova.js"></script>
        <script type="text/javascript" src="resources/js/index.js"></script>
        <script type="text/javascript">
            app.initialize();
            console.log("ready");
            document.addEventListener("deviceready", app.mainLaunch, false);
        </script>
    </head>
    <body>
    </body>
    </html>

    app.js:

    Code:
    Ext.application({    name: 'ApplicationName',
    requires: ['Ext.MessageBox'],
    launch: function() {
        console.log("launch");
        this.launched = true;
        this.mainLaunch();
    },
    mainLaunch: function() {
        //console.log('Device name: ' + device.name);
        if (!this.launched) {return;}
        Ext.fly('appLoadingIndicator').destroy();
    
    
    
    
        Ext.create('Ext.Container', {
          fullscreen: true,
          layout: {
              type: 'vbox',
              pack: 'center'
          },
          items: [
              {
                  xtype : 'toolbar',
                  docked: 'top',
                  title : 'Ext.Audio'
              },
              {
                  xtype: 'toolbar',
                  docked: 'bottom',
                  defaults: {
                      xtype: 'button',
                      handler: this.playAndroidNativeSound
                  },
                  items: [
                      { text: 'Play', flex: 1 }
                  ]
              }
          ]
      });
    },
    playAndroidNativeSound: function() {
        var src = '/android_asset/www/src/crash.mp3';
        var media = new Media(src);
        media.play();
    }});



    The Ext.Audio when compile my app does not works.

    Can you help me?

    Thanks

  7. #7
    Sencha User Pulp Fiction's Avatar
    Join Date
    Mar 2013
    Location
    Italy
    Posts
    75
    Answers
    2
    Vote Rating
    -1
    Pulp Fiction is an unknown quantity at this point

      0  

    Default


    Hi MakeSourceCode, I have the same problem, you were right to use the phonegap media plugin. This is what I did: I initialized phonegap in my app from the sencha CMD, "sencha phonegap init com.sencha.MyApp". After in the phonegap folder I load the media plugin with this command with the CMD:

    cordova plugin add org.apache.cordova.media

    look at the folder "MyApp/phonegap/plugins" and you should find the plugin. I don't know if with this type of configuration is also necessary to load "cordova.js" from the index.html.

    We must also set the config.xml for the reference to the plugin for Android:

    <feature name="Media">
    <param name="android-package" value="org.apache.cordova.media.AudioHandler" />
    </feature>

    I think I've used the exact procedure, I don't know because it still doesn't work.