Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9409] iOS: AudioPlayer - Cannot play local mp3 file

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionCannot Reproduce
Resolution Date2016-10-18T13:14:33.000+0000
Affected Version/sRelease 2.0.2, Release 2.1.0
Fix Version/sn/a
ComponentsiOS
Labelsapi, parity
ReporterWilson Luu
AssigneeHans Knöchel
Created2012-06-05T18:12:43.000+0000
Updated2017-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

FileDateSize
file_error.png2012-06-05T18:12:43.000+0000106067
good.mp32012-06-06T09:25:18.000+000045998
music.mp32012-06-05T18:12:43.000+00001073911

Comments

  1. Wilson Luu 2012-06-06

    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
  2. Shawn Lipscomb 2012-08-20

  3. Shawn Lipscomb 2013-06-04

    Another testcase: {panel:title=app.js}
       SoundtrackPlayer=Ti.Media.createAudioPlayer({
                          url:'APopularSong.mp3',
                          allowBackground:false
                        });
       SoundtrackPlayer.start();
       
    {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.
  4. Shameer Jan 2014-08-28

    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
  5. Daniel Kunzler 2014-10-03

    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?
  6. Daniel Kunzler 2015-01-02

    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).
  7. Hans Knöchel 2016-10-18

    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();
       
    Test-case 2 (play after click):
       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();
       
  8. Lee Morris 2017-03-23

    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

JSON Source