[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;
};
2. Add music.mp3 attachment to Resource folder
3. Launch app on iOS device
4. Press *Play Audio*
Actual: Get a file error dialog (see file_error.png) and the warning appears in the console:
Jun 5 18:08:01 unknown monkeyButt2[1379] <Warning>: No audio data found.
Expected: App should be able to play local mp3 files
Note:
* Above code works as expected on Android
* This is *not* a regression. This bug appears in SDK build 2.0.2.GA.
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}
{panel} Under iOS, trying to play the local audio file (the MP3 file exists in the Resources directory of the project) using Ti.Media.AudioPlayer fails with the following error message (popup dialog): {panel}{noformat}Unable to configure network read stream{noformat}{panel} and the song does not play. The same code works correctly on Android. Therefore, it is also a parity issue.
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):
Test-case 2 (play after click):
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