[TIMOB-14552] iOS: Setting the position of the audio playBack in audioPlayer
| GitHub Issue | n/a |
|---|---|
| Type | New Feature |
| Priority | Low |
| Status | Reopened |
| Resolution | Unresolved |
| Affected Version/s | Release 3.1.0, Release 3.1.1, Release 8.1.0 |
| Fix Version/s | n/a |
| Components | iOS |
| Labels | axe, module_media, qe-testadded, supportTeam |
| Reporter | Rupesh Sharma |
| Assignee | Unknown |
| Created | 2013-07-15T10:54:16.000+0000 |
| Updated | 2019-07-24T14:31:32.000+0000 |
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();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
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
Any progress on this? This kind of a basic function of an audio player.