Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14552] iOS: Setting the position of the audio playBack in audioPlayer

GitHub Issuen/a
TypeNew Feature
PriorityLow
StatusReopened
ResolutionUnresolved
Affected Version/sRelease 3.1.0, Release 3.1.1, Release 8.1.0
Fix Version/sn/a
ComponentsiOS
Labelsaxe, module_media, qe-testadded, supportTeam
ReporterRupesh Sharma
AssigneeUnknown
Created2013-07-15T10:54:16.000+0000
Updated2019-07-24T14:31:32.000+0000

Description

Description

Ability to set the position of the media playback to start the media from the middle instead of from start.

Comments

  1. Vishal Duggal 2013-10-21

    We can not implement the requested functionality. What we can implement is the ability to set stream position. Test Case
       var win = Titanium.UI.createWindow({  
           backgroundColor:'#fff',
       });
        
       var audioPlayer = Ti.Media.createAudioPlayer({ 
           url: 'http://tenminutepodcast.com/Audio/BitKillerJones.mp3',
       });           
       
       var start = Ti.UI.createButton({title:'START', top:30, left:10});
       var pause = Ti.UI.createButton({title:'PAUSE', top:30});
       var stop = Ti.UI.createButton({title:'STOP', top:30, right:10});
       
       
       win.add(start);
       win.add(pause);
       win.add(stop);
       
       var slider = Ti.UI.createSlider({
           min:0,
           max:612000,
           visible:false,
           width:'80%'
       })
       
       win.add(slider);
       
       var updateOnProgress = false;
       audioPlayer.addEventListener('progress',function(e){
       
           if (updateOnProgress) {
               slider.value = e.progress;
           }
       })
       
       
       function resetPlayer(e)
       {
           Ti.API.info('RESET PLAYER');
           audioPlayer.stop();
           slider.visible = false;
           updateOnProgress = false;
           slider.value = 0;
       }
       
       audioPlayer.addEventListener('change',function(e){
           if (e.state == audioPlayer.STATE_STOPPED) {
               resetPlayer(e);
           }
       })
       
       start.addEventListener('click',function(e){
           slider.visible = true;
           updateOnProgress = true;
           audioPlayer.start();
       })
       
       stop.addEventListener('click',resetPlayer)
       
       pause.addEventListener('click',function(e){
           audioPlayer.pause();
       })
       
       slider.addEventListener('touchstart',function(e){
           updateOnProgress = false;
       })
       
       function updateStream(e){
           audioPlayer.seekToTime(slider.value);
           updateOnProgress = true;
       }
       
       slider.addEventListener('touchend',updateStream);
       slider.addEventListener('touchcancel',updateStream);
       
       win.open();
       
  2. Vishal Duggal 2013-10-21

    Pull pending against master https://github.com/appcelerator/titanium_mobile/pull/4817 The above PR has been reverted. https://github.com/appcelerator/titanium_mobile/pull/4890
  3. Olga Romero 2013-10-29

    Tested with: Mac osx 10.9 Mavericks Titanium Studio, build: 3.2.0.201310290757 CLI 3.2.0 Although it works on iOS 6 and 7 Simulators, it fails on Device: iPhone5s iOS 7.0.2
  4. Brad Ball 2016-01-12

    Any progress on this? This kind of a basic function of an audio player.

JSON Source