Results 1 to 3 of 3

Thread: Ext.audio in PhoneGap

  1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    2
    Vote Rating
    0
      0  

    Default 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 User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,050
    Answers
    3976
    Vote Rating
    1381
      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 @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Oct 2012
    Posts
    2
    Vote Rating
    0
      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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •