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

iOS: Ti.Media.Audio player without url set is crashing while registering for event listener

    Details

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: Release 7.5.0
    • Fix Version/s: Release 7.5.0
    • Component/s: iOS
    • Labels:
    • Environment:

      SDK Version 7.5.0
      APPC Studio: 5.1.0.201808080937
      iPhone 6 Sim (iOS 12.1)
      APPC CLI: 7.0.6
      Operating System Name: Mac OS Mojave
      Operating System Version: 10.14.1
      Node.js Version: 8.9.1
      Xcode 10.0

    • Story Points:
      5
    • Sprint:
      2018 Sprint 23

      Description

      The application throws an error when using the following test case:

      var win = Ti.UI.createWindow({
          backgroundColor: '#fff'
      });
       
      	var debug = Ti.API.debug;
      	var info = Ti.API.info;
      	Ti.Media.audioSessionMode = Ti.Media.AUDIO_SESSION_MODE_PLAYBACK;
       
      	var url = Titanium.UI.createTextField({
      		value : 'http://users.skynet.be/fa046054/home/P22/track06.mp3',
      		color : '#336699',
      		returnKeyType : Titanium.UI.RETURNKEY_GO,
      		keyboardType : Titanium.UI.KEYBOARD_URL,
      		hintText : 'url',
      		textAlign : 'left',
      		height : 35,
      		top : 10,
      		width : 300,
      		borderStyle : Titanium.UI.INPUT_BORDERSTYLE_ROUNDED
      	});
       
      	var streamButton = Titanium.UI.createButton({
      		title : 'Start Streaming',
      		top : 60,
      		width : 200,
      		height : 40
      	});
       
      	var pauseButton = Titanium.UI.createButton({
      		title : 'Pause Streaming',
      		top : 110,
      		width : 200,
      		height : 40,
      		enabled : false
      	});
       
      	var progressLabel = Titanium.UI.createLabel({
      		text : 'Time Played: Not Started',
      		top : 160,
      		left : 10,
      		height : 40,
      		width : 300,
      		color : '#555',
      		textAlignment : 'center'
      	});
       
      	var stateLabel = Titanium.UI.createLabel({
      		text : 'State: Not Started',
      		top : 180,
      		left : 10,
      		width : 300,
      		height : 40,
      		color : '#555'
      	});
       
      	win.add(url);
      	win.add(streamButton);
      	win.add(pauseButton);
      	win.add(progressLabel);
      	win.add(stateLabel);
       
      	var streamer = Ti.Media.createAudioPlayer();
       
      	streamButton.addEventListener('click', function() {
      		if (streamButton.title == 'Stop Stream') {
      			progressLabel.text = 'Stopped';
      			streamer.stop();
      			pauseButton.enabled = false;
      			pauseButton.title = 'Pause Streaming';
      			streamButton.title = "Start Streaming";
      		} else {
      			progressLabel.text = 'Starting ...';
      			streamer.url = url.value;
      			streamer.start();
      			pauseButton.enabled = true;
      			pauseButton.title = 'Pause Streaming';
      			streamButton.title = "Stop Stream";
      		}
      	});
       
      	pauseButton.addEventListener('click', function() {
      		if (pauseButton.title == 'Pause Streaming') {
      			streamer.pause();
      			pauseButton.title = 'Unpause Streaming';
      		} else {
      			streamer.start();
      			pauseButton.title = 'Pause Streaming';
      		}
      	});
       
      	streamer.addEventListener('change', function(e) {
      		stateLabel.text = 'State: ' + e.description + ' (' + e.state + ')';
      		Ti.API.info('disc: ' + e.description);
      		Ti.API.info('state: ' + e.state);
      	});
       
      	streamer.addEventListener('progress', function(e) {
      		progressLabel.text = 'Time Played: ' + Math.round(e.progress) + ' seconds';
      	});
       
      	// save off current idle timer state
      	var idleTimer = Ti.App.idleTimerDisabled;
       
      	// while we're in this window don't let the app shutdown
      	// when the screen is idle
      	Ti.App.idleTimerDisabled = true;
       
      	win.addEventListener('close', function() {
      		Ti.API.info("window was closed, idleTimer reset to = " + idleTimer);
       
      		// restore previous idle state when closed
      		Ti.App.idleTimerDisabled = idleTimer;
      	});
       
      	win.open();
      

      Following error is shown:

      [ERROR] :  Script Error {
      [ERROR] :      column = 26;
      [ERROR] :      line = 97;
      [ERROR] :      message = "Invalid URL passed to the audio-player";
      [ERROR] :      nativeLocation = "-[TiMediaAudioPlayerProxy player] (TiMediaAudioPlayerProxy.m:76)";
      [ERROR] :      nativeReason = "The \"url\" probably has not been set to a valid value.";
      [ERROR] :      nativeStack = "3   T3    0x00000001011081e8 T3 + 508392\n4   T3    0x000000010110c000 T3 + 524288\n5   T3    0x000000010110b988 T3 + 522632\n6   T3    0x0000000101106b78 T3 + 502648\n7   CoreFoundation  0x0000000185a35630 <redacted> + 144\n8   CoreFoundation  0x0000000185913560 <redacted> + 292\n9   T3    0x00000001010ad8e8 T3 + 137448\n10  T3    0x00000001010abfcc T3 + 131020\n11  T3    0x0000000101128c1c T3 + 642076\n12  T3    0x00000001010abcec T3 + 130284\n13  JavaScriptCore  0x000000018d656b58 <redacted> + 348\n14  JavaScriptCore  0x000000018dd40f5c <redacted> + 352\n15  JavaScriptCore  0x000000018d62ddd8 <redacted> + 29992\n16  JavaScriptCore  0x000000018d62ddec <redacted> + 30012\n17  JavaScriptCore  0x000000018d6266b4 <redacted> + 308\n18  JavaScriptCore  0x000000018dc9cda0 <redacted> + 9620\n19  JavaScriptCore  0x000000018de77ecc _ZN3JSC8evaluateEPNS_9ExecStateERKNS_10SourceCodeENS_7JSValueERN3WTF8NakedPtrINS_9ExceptionEEE + 320";
      [ERROR] :      sourceURL = "file:///var/containers/Bundle/Application/977A5AE0-84DB-4956-B8B5-79A219E25A27/T3.app/app.js";
      [ERROR] :      stack = "    at [native code]\n    at (/app.js:97:26)\n    at global code(/app.js:116:70)\n    at require@[native code]\n    at (/ti.main.js:27:8)\n    at loadAsync(/ti.internal/bootstrap.loader.js:148:186)\n    at global code(/ti.main.js:24:52)";
      [ERROR] :      toJSON = "<KrollCallback: 0x281918ac0>";
      [ERROR] :  }
      [ERROR] :  Script Error Module "app.js" failed to leave a valid exports object
      

      Note this worked on 7.4.1.GA and looks like a regression.

      Expected result
      Application should not crash and stream should work accordingly. (If stream is paused/played)

      *Actual result *
      Application crashes on launch

        Attachments

          Activity

            People

            • Assignee:
              vijaysingh Vijay Singh
              Reporter:
              smohammed Samir Mohammed
              Reviewer:
              Jan Vennemann
              Tester:
              Samir Mohammed
            • Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-6683
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Source Code