1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    2
    Vote Rating
    0
    ster is on a distinguished road

      0  

    Default Unanswered: Ext.audio in PhoneGap

    Unanswered: Ext.audio in PhoneGap


    Hi all,
    I am new to Sencha Touch 2. Was trying to implement dynamic update of Audio url via a drop down menu.

    The setup is simple, I have an audio object added to a panel.

    I tried updateUrl and setUrl to the existing audio url but no dice. When it loaded, the audio plays but when the url is updated, the url is updated but the audio will not play.

    Then I try to do a add and remove an new audio object with the updated url. The first add always works but when I remove the object and add a new, again the url is updated but the audio will not play.

    Both methods(update url and object add/remove) work in Chrome but when I compile it to run in PhoneGap and then on the phone, it didn't.

    Here is my code snippet:

    change: function(thisSelection, newValue, oldValue) {
    var currentAudio = this.getRadioPanel().down('audio');
    if ( currentAudio != null ) {
    if ( currentAudio.isPlaying() ) {
    currentAudio.stop();
    }
    currentAudio.destroy();
    this.getRadioPanel().removeAll();
    }

    var newAudio = Ext.create("Ext.Audio", {
    url: newValue
    });

    this.getRadioPanel().add(newAudio);
    this.getRadioPanel().setHtml(newAudio.getUrl());
    newAudio.play();

    if ( newAudio.isPlaying() ) {
    this.getRadioControlButton().setText('Stop');
    } else {
    this.getRadioControlButton().setText('Start');
    }
    }

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,144
    Answers
    3505
    Vote Rating
    855
    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

      1  

    Default


    I don't see why that doesn't work on the ST side of things. Does this work in Chrome/Safari?
    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
    Oct 2012
    Posts
    2
    Vote Rating
    0
    ster is on a distinguished road

      0  

    Default


    Hi Mitchell
    Yes, the code does work in Safari and Chrome. I even try to add a 2 sec timeout before changing the URL but it still will not play after the URL is changed.

    Could it be the phone? I am using a Samsung Galaxy Note.

    Thanks

Thread Participants: 1