Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25574] iOS: SDK 7.0.0 - App crashes with exception when closing window that contains videoplayer

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2017-12-13T22:37:02.000+0000
Affected Version/sRelease 7.0.0
Fix Version/sRelease 7.0.1
ComponentsiOS
Labelsn/a
ReporterKristjan Brand
AssigneeHans Knöchel
Created2017-11-30T14:27:52.000+0000
Updated2017-12-14T01:13:43.000+0000

Description

*Steps to reproduce:* - Create a new project. - Add this code to index.js
var win2 = Titanium.UI.createWindow({
    backgroundColor: 'red',
    title: 'Red Window'
});

var win1 = Titanium.UI.iOS.createNavigationWindow({
   window: win2
});

var win3 = Titanium.UI.createWindow({
    backgroundColor: 'blue',
    title: 'Blue Window'
});

var button = Titanium.UI.createButton({
    title: 'Open Blue Window'
});
button.addEventListener('click', function(){
    win1.openWindow(win3, {animated:true});
});

win2.add(button);
var button2 = Titanium.UI.createButton({
    title: 'Close Blue Window'
});
button2.addEventListener('click', function(){
    win1.closeWindow(win3, {animated:false}); //win3.close() will also work!!
});
var videoPlayer = Titanium.Media.createVideoPlayer({
	url: 'https://www.w3schools.com/html/mov_bbb.mp4',
    top : 2,
    autoplay : true,
    backgroundColor : 'blue',
    height : 300,
    width : 300,
    mediaControlStyle : Titanium.Media.VIDEO_CONTROL_DEFAULT,
    scalingMode : Titanium.Media.VIDEO_SCALING_ASPECT_FIT
});
win3.add(videoPlayer);
win3.add(button2);
win1.open();
- Run the app in ios simulator. - Click on "Open blue window" button. - Click on "Close blue window" button. *Actual result:* App crashes with exception:
[ERROR] :  The application has crashed with an uncaught exception 'NSInternalInconsistencyException'.
[ERROR] :  Reason:
[ERROR] :  Cannot update for observer <TiMediaVideoPlayerProxy 0x7fb91584d000> for the key path "player.status" from <AVPlayerViewController 0x7fb91685a800>, most likely because the value for the key "player" has changed without an appropriate KVO notification being sent. Check the KVO-compliance of the AVPlayerViewController class.
[ERROR] :  Stack trace:
[ERROR] :  0   CoreFoundation                      0x0000000111d5baf3 __exceptionPreprocess + 147
[ERROR] :  1   libobjc.A.dylib                     0x0000000111291141 objc_exception_throw + 48
[ERROR] :  2   CoreFoundation                      0x0000000111dc4625 +[NSException raise:format:] + 197
[ERROR] :  3   Foundation                          0x000000010c80d371 -[NSKeyValueNestedProperty object:withObservance:didChangeValueForKeyOrKeys:recurse:forwardingValues:] + 776
[ERROR] :  4   Foundation                          0x000000010c7e1fe2 NSKeyValueDidChange + 179
[ERROR] :  5   Foundation                          0x000000010c8bf90f -[NSObject(NSKeyValueObservingPrivate) _changeValueForKeys:count:maybeOldValuesDict:usingBlock:] + 868
[ERROR] :  6   Foundation                          0x000000010c7a7f8c -[NSObject(NSKeyValueObservingPrivate) _changeValueForKey:key:key:usingBlock:] + 61
[ERROR] :  7   Foundation                          0x000000010c80cee6 _NSSetObjectValueAndNotify + 262
[ERROR] :  8   TestProject                         0x000000010ab31875 -[TiMediaVideoPlayerProxy windowWillClose] + 133
[ERROR] :  9   CoreFoundation                      0x0000000111d01e8d -[NSArray makeObjectsPerformSelector:] + 269
[ERROR] :  10  TestProject                         0x000000010aa8bec1 -[TiViewProxy windowWillClose] + 65
[ERROR] :  11  TestProject                         0x000000010ac6be60 -[TiWindowProxy windowWillClose] + 256
[ERROR] :  12  TestProject                         0x000000010ab5841c -[TiUIiOSNavWindowProxy navigationController:willShowViewController:animated:] + 348
[ERROR] :  13  UIKit                               0x000000010cedec2f -[UINavigationController _startTransition:fromViewController:toViewController:] + 1011
[ERROR] :  14  UIKit                               0x000000010cedfa03 -[UINavigationController _startDeferredTransitionIfNeeded:] + 843
[ERROR] :  15  UIKit                               0x000000010cee0b41 -[UINavigationController __viewWillLayoutSubviews] + 58
[ERROR] :  16  UIKit                               0x000000010d0d260c -[UILayoutContainerView layoutSubviews] + 231
[ERROR] :  17  UIKit                               0x000000010cdbf55b -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1268
[ERROR] :  18  QuartzCore                          0x000000010ffeb904 -[CALayer layoutSublayers] + 146
[ERROR] :  19  QuartzCore                          0x000000010ffdf526 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 370
[ERROR] :  20  QuartzCore                          0x000000010ffdf3a0 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
[ERROR] :  21  QuartzCore                          0x000000010ff6ee92 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294
[ERROR] :  22  QuartzCore                          0x000000010ff9b130 _ZN2CA11Transaction6commitEv + 468
[ERROR] :  23  UIKit                               0x000000010ccf5367 _UIApplicationFlushRunLoopCATransactionIfTooLate + 167
[ERROR] :  24  UIKit                               0x000000010d4f67a3 __handleEventQueue + 5843
[ERROR] :  25  CoreFoundation                      0x0000000111d01c01 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
[ERROR] :  26  CoreFoundation                      0x0000000111ce70cf __CFRunLoopDoSources0 + 527
[ERROR] :  27  CoreFoundation                      0x0000000111ce65ff __CFRunLoopRun + 911
[ERROR] :  28  CoreFoundation                      0x0000000111ce6016 CFRunLoopRunSpecific + 406
[ERROR] :  29  GraphicsServices                    0x0000000113467a24 GSEventRunModal + 62
[ERROR] :  30  UIKit                               0x000000010ccfc134 UIApplicationMain + 159
[ERROR] :  31  TestProject                         0x000000010aa4d114 main + 100
[ERROR] :  32  libdyld.dylib                       0x0000000112dbe65d start + 1
[ERROR] :  33  ???                                 0x0000000000000001 0x0 + 1
*Expected result:* App closes the window without any exception. Please let me know if there is any additional information needed to reproduce.

Comments

  1. Hans Knöchel 2017-11-30

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/9641 PR (7_0_X): https://github.com/appcelerator/titanium_mobile/pull/9664 Test-case above, unit-test in the PR.
  2. Eric Wieber 2017-12-12

    FR Passed. App no longer crashes when a window with a playing video in it is closed
  3. Eric Wieber 2017-12-14

    Verified in SDK builds 7.0.1.v20171213104555 & 7.1.0.v20171213155647

JSON Source