Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17883] Android 5.0: Audio player does not start/resume once stopped

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionHold
Resolution Date2014-11-12T00:42:59.000+0000
Affected Version/sRelease 3.4.1
Fix Version/sn/a
ComponentsAndroid
Labelsqe-3.4.1
ReporterLokesh Choudhary
AssigneeHieu Pham
Created2014-10-22T00:17:31.000+0000
Updated2017-03-20T18:05:35.000+0000

Description

This issue is seen when streaming audio too & not just local file.

Description:

1. Create a classic app & replace the app.js with the following code:
var _window = Ti.UI.createWindow({
	backgroundColor:'white',
	layout:'vertical'
});

var startButton = Titanium.UI.createButton({
	    title:'Start Playing',
	    top:10,
	    width:200,
	    height:40
	});
	 
var stopButton = Titanium.UI.createButton({
    title:'Stop playing',
    top:10,
    width:200,
    height:40,
    enabled:true
});
 
_window.add(startButton);
_window.add(stopButton);
 
var audioPlayer = Ti.Media.createAudioPlayer({ 
    url: 'Uppermost - Flow.mp3',
    allowBackground: true
});           
    
startButton.addEventListener('click',function() {
  audioPlayer.start();
});
 
stopButton.addEventListener('click', function() {
 audioPlayer.stop();
});
 
audioPlayer.addEventListener('progress',function(e) {
    Ti.API.info('Time Played: ' + Math.round(e.progress) + '/' + audioPlayer.getDuration() + 'milliseconds');
});
 
audioPlayer.addEventListener('change',function(e)
{
    Ti.API.info('State: ' + e.description + ' (' + e.state + ')');
});
 
_window.addEventListener('close',function() {
    audioPlayer.stop();
    if (Ti.Platform.osname === 'android')
    { 
        audioPlayer.release();
    }
});

_window.open();
2. Use the attached audio file in your app. 3. Build for device flashed with android 5.0 preview. 4. After the app launches press the "Start Playing" button. 5. The audio player will start playing. 6. Press the "Stop Playing" button. 7. The audio player will stop playing. 8. Now again press the "Start Playing" button.

Actual Result:

1. The audio player does not play when the "Start Playing" button is pressed the second time. 2. On a non android 5.0 device(Samsung galaxy S4 - android 4.4.2) the audio player stops and starts as expected.

Expected Result:

1. The audio player should start again after it has been stopped.

Attachments

FileDateSize
Uppermost - Flow.mp32014-10-22T00:18:15.000+00004109324

Comments

  1. Ingo Muschenetz 2014-10-22

    FYI. Placing this into Triage.
  2. Lokesh Choudhary 2014-10-23

    I am seeing this sometimes, where the audio does not start streaming at the first time when the app is run. Not sure if its the same cause as this ticket, if not please comment & I will open a separate ticket for it.
  3. Hieu Pham 2014-10-31

    The media hangs indefnitely on prepare() call. After some researching, looks like a native problem: https://code.google.com/p/android-developer-preview/issues/detail?id=1787
  4. Ingo Muschenetz 2014-11-12

    It appears to be a Google bug. Resolving on hold.
  5. Lee Morris 2017-03-20

    Closing ticket due to time passed and that the issue was a Goggle bug and nothing to do with us.

JSON Source