Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-27105

Android:Ti.Media.Sound is triggering error event handler

    Details

    • Type: Bug
    • Status: Open
    • Priority: None
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Android
    • Labels:
      None

      Description

      In project, the customer is trying to download an audio file from server and playing it in Android application. In Android, with Titanium.Media.Sound API they are observing “error” event handler is being fired, even though the Audio is playing correctly. And this behaviour is being observed only in Samsung S4 with OS version 4.4.2, Samsung G6 with OS version 8.0.0 and Samsung J7 with Os version 7.1.0

      And it is working fine with out firing error event handler in Nexus with OS version 6.0.1, Google pixel with OS version 9.0. 

      Note: The customer's app is currently running with 7.5.2.GA . The issue is tested on our end with SDK 7.5.2.GA and 8.0.1.GA. The “error” event handler is being fired on Samsung J7 Prime2 v8.0.0 device.

      Test code:

      var accessToken;
      var win = Ti.UI.createWindow({
      	title : "Main window",
      	backgroundColor : "white" 
      });
      var button = Ti.UI.createButton({
      	title : "Audio"
      });
      button.addEventListener('click', function(e) {
      	var sound = Titanium.Media.createSound({
      		url: "SampleAudio.mp3",  
      		allowBackground : true,
      		volume : 1.0
      	});
      	sound.play();
      	sound.addEventListener('complete', function(evt1) {
      		sound.release();
      	});
      	sound.addEventListener('error', function(evt2){
      		Ti.API.info('Error in sound::'+JSON.stringify(evt2));
      		if (evt2.error.toLowerCase().trim() === 'unknown media issue.') {
      			return;
      		} else {
      			dialog = Ti.UI.createAlertDialog({
      				message : "Audio failed",
      				buttonNames : ['OK']
      			});
      			dialog.show();
      			sound.release();
      		}
      	});
      });
      win.add(button);
      win.open();
      
      

      Test steps:

      1.Create a classic app and replace app.js with the attached app.js file. 
      2. Download the sample audio file and place in Resources/android folder. 
      3.Run the app , "Click Audio" and you will observe the issue. 

      [INFO]  Error in sound::{"type":"error","source":{"volume":1,"url":"file:///android_asset/Resources/SampleAudio.mp3","time":0,"playing":true,"audioType":0,"looping":false,"paused":fals
      e,"duration":27745,"apiName":"Ti.Media.Sound","bubbleParent":true,"allowBackground":true,"state":3,"stateDescription":"playing","_events":{"complete":{},"error":{}}},"bubbles":false,"success
      ":false,"code":-1,"error":"Unknown media issue.","cancelBubble":false}
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jquick Joshua Quick
                Reporter:
                rmitro Rakhi Mitro
              • Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Source Code