[TIMOB-9409] iOS: AudioPlayer - Cannot play local mp3 file
| GitHub Issue | n/a | 
|---|---|
| Type | Bug | 
| Priority | Medium | 
| Status | Closed | 
| Resolution | Cannot Reproduce | 
| Resolution Date | 2016-10-18T13:14:33.000+0000 | 
| Affected Version/s | Release 2.0.2, Release 2.1.0 | 
| Fix Version/s | n/a | 
| Components | iOS | 
| Labels | api, parity | 
| Reporter | Wilson Luu | 
| Assignee | Hans Knöchel | 
| Created | 2012-06-05T18:12:43.000+0000 | 
| Updated | 2017-03-23T21:13:45.000+0000 | 
Description
	Steps to reproduce:
1. Put following code in TiMobile project:
var win = Ti.UI.createWindow({
	layout: 'vertical',
	backgroundColor: 'white'
});
 
var audio = Ti.Media.createAudioPlayer({url: 'music.mp3', volume: 0.5});
win.add(createVolumeControl(audio));
 
var playAudioButton = Ti.UI.createButton({
	title: "Play Audio",
    height: 100,
    width: 200
});
playAudioButton.addEventListener('click', function() {
    //audio.play();
    audio.start();
});
win.add(playAudioButton);
win.open();
function createVolumeControl(player) {
    var slider = Ti.UI.createSlider({
        value: player.volume * 100,
        min: 0,
        max: 100,
        width: Ti.UI.FILL
    });
 
    slider.addEventListener('change', function(e) {
        player.volume = e.value/100;
    });
 
    return slider;
};
Jun  5 18:08:01 unknown monkeyButt2[1379] <Warning>: No audio data found.
Attachments
| File | Date | Size | 
|---|---|---|
| file_error.png | 2012-06-05T18:12:43.000+0000 | 106067 | 
| good.mp3 | 2012-06-06T09:25:18.000+0000 | 45998 | 
| music.mp3 | 2012-06-05T18:12:43.000+0000 | 1073911 | 
Hey Neeraj: I tried good.mp3 from TIMOB-4992 and the same bug appears. Details about the mp3s: *good.mp3* Duration: 4 sec Content: talking about toads *music.mp3* Duration: 1 min 7 sec Content: acoustic sci-fi music
Another testcase: {panel:title=app.js}
SoundtrackPlayer=Ti.Media.createAudioPlayer({ url:'APopularSong.mp3', allowBackground:false }); SoundtrackPlayer.start();Issue still exists with SDK Version 3.4.0 Titanium Command-Line Interface, CLI version 3.3.0, Titanium SDK version 3.4.0.GA Appcelerator Studio, build: 3.3.0.201407111535 iOS SDK: 7.0
Issue is two-year-old (with medium priority) and still exists with SDK 3.4.0, iOS SDK 8.0 CLI version 3.4.0 Titanium SDK version 3.4.0.GA Titanium Studio, build: 3.4.0.201409261227 iOS SDK: 8.0 Is there any workaround to play long local MP3 files on iOS?
I could confirm that using a Webview is NOT a workaround for this issue. It consumes more resources and it plays MP3s on full screen on iPhones (but good on iPad).
Cannot reproduce with Titanium SDK 5.5.1.GA and later using both kroll- and main-thread. Test-case 1 (play directly):
var win = Ti.UI.createWindow({ layout: 'vertical', backgroundColor: 'white' }); var SoundtrackPlayer=Ti.Media.createAudioPlayer({ url:'music.mp3', allowBackground:false }); SoundtrackPlayer.start(); win.open();var win = Ti.UI.createWindow({ layout: 'vertical', backgroundColor: 'white' }); var audio = Ti.Media.createAudioPlayer({url: 'music.mp3', volume: 0.5}); var playAudioButton = Ti.UI.createButton({ title: "Play Audio", height: 100, width: 200 }); playAudioButton.addEventListener('click', function() { //audio.play(); audio.start(); }); win.add(playAudioButton); win.open();Can verify this ticket as "Cannot Reproduce". Tested with the following environment; iPhone 7 and Simulator (10.2) MacOS 10.11.6 (15G31) Studio 4.8.1.201612050850 Ti SDK 6.0.3 GA Appc NPM 4.2.8 Appc CLI 6.1.0 Ti CLI 5.0.11 Alloy 1.9.5 Arrow 1.10.1 Xcode 8.2 (8C38) Node v4.6.0 Java 1.7.0_80