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

      0  

    Default Unanswered: Issue with audio "ended" event

    Unanswered: Issue with audio "ended" event


    Hi there,

    i'm fairly new to sencha and need some help
    i'm tryin' to build a topdocked audio player. i got a selectfield with my tracks listed from a store.
    if i push the play button the audio is playing, and if i'm switching the audio, the sound is still going on - works fine - till yet. i'm using the ".play(), .toggle() and .updateUrl() " method.
    in my controller i'm using the "ended" event on the audio to check if the audio file is ended and then get the actual index from my store to increase it by 1 to get the new audio to update the url and play the song.

    but the "ended" event works only once! and i really dont no why... it's upsetting! maybe someone of you could help me to go on!

    Code:
    config: {
            refs: {
                audioSelect: '#audioselect',
                audioFile: '#audioTpl',
            },
    
    control: {
    
    
                audioSelect: {
                    change: 'changeAudioFile'
                },
    
    
                audioFile: {
                    ended: 'updateAudioFile'
                },
    },
    
    changeAudioFile: function(newValue, oldValue, eOpts){
            var audio = this.getAudioSelect();
            var audioFile = this.getAudioFile();
            var playText = this.getAudioPlayer().down('button').getText();
            
            audioFile.updateUrl(oldValue);
            if (playText == 'Pause') {
                audioFile.play();
                audioFile.create();
            }       
    
    
        },
    
    
        updateAudioFile: function(time, eOpts){
            var audio = this.getAudioSelect();
            var audioFile = this.getAudioFile();
            var file = audio.getValue();
            var currentIndex = audio.getStore().findExact("src", file);
            var storeLength = audio.getStore().getCount();
    
    
            if (currentIndex !== storeLength-1) {
                currentIndex++;
            }
            var newUrl = audio.getStore().getAt(currentIndex).get("src");
            audio.setValue(newUrl);
            audioFile.play();
        }
    
    });
    thanks!

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,780
    Answers
    3465
    Vote Rating
    833
    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


    Aren't the arguments for the ended event the component and the time not just the time?

    As a debugging step you can add a listener to the audio.media.dom for the ended event that the actual <audio> element.
    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
    Jul 2012
    Posts
    2
    Vote Rating
    0
    soflyaway is on a distinguished road

      0  

    Default Rookie

    Rookie


    Hey!

    Thanks for your reply. Oh...i passed the parameter (this, time) and got an error...so with your advice i renamed this in "element" and get infos about the element first step done!
    But what to do now? Have i to reset the Listener? and how to do this, if

    thanks and best regards!
    Fabian

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,780
    Answers
    3465
    Vote Rating
    833
    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


    You can't use this as an argument, it will be the audio component.
    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.

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi