-
Notifications
You must be signed in to change notification settings - Fork 13
Description
Describe the bug
So in my react native application, I am experiencing issues where sometimes when skipping to the next video (either with the player controls, or progamatically doing it by updating the player index) the app would crash.
My observation has been that the chances of it crashing are higher when the existing video is still 'playing' while starting a new video.
For example, if I had to pause the video, then skip to the next video, I would not see the crash happening. But if I try start a new video while the existing video is still loading or playing, then things can go wrong (one instance of it happening is when the video is buffering and I start a new video playback, so in the case of skipping through videos quickly).
Almost all of the time though, the reason for the crash appears to be the same
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[AVPlayerItem addOutput:] Cannot attach an output that is already attached or nil output'
Im also experiencing an issue when loading a playlist of locally sourced files, where the video playback may not play, but the audio does. In these cases the app won't crash, but the video won't be playing. Again, if I pause each video before playing the next one, this seems to mitigate the issue as well.
One attempt at trying to handle this myself, was to try to see if I could programmatically control the pausing and playing the next video when the user skips, but I don't seem to have access to this method or hook. (so, 'onSkip', I would wish to pause the current video, wait 1 second, then proceed to continuing the operation of playing the next playlist video). But, this isn't currently possible and not sure if this could be explosed eventually. But ideally I wouldn't want or need to do this if the underlying issue is resolved.
To Reproduce
I created a brand new expo project. Installed the latest JWPlayer package. The loaded a player with 7 videos in the playlist.
If I quickly skip back and forth through the videos in the playlist, the app would would crash at some point with the error.
Expected behavior
My expected behaviour is that the audio and video items are being correctly handled in the SDK so this issue would not happen. (not crashing, and not having my offline/local videos playing correctly with both audio and video)
Screenshots / Visual evidence
Can view a screen recorded reproduction here
https://drive.google.com/file/d/1wvZDwRgOFacAd-1iae8KRcvbBIKznlIj/view?usp=sharing
Desktop (please complete the following information):
If you are having a build issue, we would like to know about your machine.
npx react-native info
info Fetching system and libraries information...
System:
OS: macOS 15.7.1
CPU: (10) arm64 Apple M4
Memory: 130.39 MB / 24.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 22.15.0
path: /Users/simonarcher/.nvm/versions/node/v22.15.0/bin/node
Yarn:
version: 1.22.22
path: /Users/simonarcher/.nvm/versions/node/v22.15.0/bin/yarn
npm:
version: 10.9.2
path: /Users/simonarcher/.nvm/versions/node/v22.15.0/bin/npm
Watchman:
version: 2025.09.15.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.16.2
path: /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 25.0
- iOS 26.0
- macOS 26.0
- tvOS 26.0
- visionOS 26.0
- watchOS 26.0
Android SDK: Not Found
IDEs:
Android Studio: 2025.1 AI-251.26094.121.2513.14007798
Xcode:
version: 26.0.1/17A400
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.16
path: /usr/bin/javac
Ruby:
version: 2.6.10
path: /usr/bin/ruby
npmPackages:
"@react-native-community/cli":
installed: 20.0.2
wanted: ^20.0.2
react:
installed: 19.1.0
wanted: 19.1.0
react-native:
installed: 0.81.5
wanted: 0.81.5
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: true
newArchEnabled: true
Package.json file of project
{
"name": "jwplayertest",
"main": "expo-router/entry",
"version": "1.0.0",
"scripts": {
"start": "expo start",
"reset-project": "node ./scripts/reset-project.js",
"android": "expo run:android",
"ios": "expo run:ios",
"web": "expo start --web",
"lint": "expo lint"
},
"dependencies": {
"@expo/vector-icons": "^15.0.3",
"@jwplayer/jwplayer-react-native": "^1.2.0",
"@react-native-community/cli": "^20.0.2",
"@react-navigation/bottom-tabs": "^7.4.0",
"@react-navigation/elements": "^2.6.3",
"@react-navigation/native": "^7.1.8",
"expo": "~54.0.20",
"expo-constants": "~18.0.10",
"expo-font": "~14.0.9",
"expo-haptics": "~15.0.7",
"expo-image": "~3.0.10",
"expo-linking": "~8.0.8",
"expo-router": "~6.0.13",
"expo-splash-screen": "~31.0.10",
"expo-status-bar": "~3.0.8",
"expo-symbols": "~1.0.7",
"expo-system-ui": "~6.0.8",
"expo-web-browser": "~15.0.8",
"react": "19.1.0",
"react-dom": "19.1.0",
"react-native": "0.81.5",
"react-native-gesture-handler": "~2.28.0",
"react-native-reanimated": "~4.1.1",
"react-native-safe-area-context": "~5.6.0",
"react-native-screens": "~4.16.0",
"react-native-web": "~0.21.0",
"react-native-worklets": "0.5.1"
},
"devDependencies": {
"@types/react": "~19.1.0",
"eslint": "^9.25.0",
"eslint-config-expo": "~10.0.0",
"typescript": "~5.9.2"
},
"private": true
}
-------------------------------------
Translated Report (Full Report Below)
-------------------------------------
Incident Identifier: 2FF54B33-EB82-4212-B44C-0C6A203C3B92
CrashReporter Key: 1DE22C14-0D49-3192-9548-70FDDF7DBFB4
Hardware Model: Mac16,12
Process: JWPlayerTest [39796]
Path: /Users/USER/Library/Developer/CoreSimulator/Devices/C97E9D88-D45A-4DBD-AFCB-9EE04B08028C/data/Containers/Bundle/Application/E7541C64-ECCE-4AD8-827C-F8A47BE4E80B/JWPlayerTest.app/JWPlayerTest
Identifier: com.xxx.JWPlayerTest
Version: 1.0.0 (1)
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd_sim [93100]
Coalition: com.apple.CoreSimulator.SimDevice.C97E9D88-D45A-4DBD-AFCB-9EE04B08028C [15911]
Responsible Process: SimulatorTrampoline [11910]
Date/Time: 2025-10-29 13:24:24.5083 +0100
Launch Time: 2025-10-29 13:23:01.7055 +0100
OS Version: macOS 15.7.1 (24G231)
Release Type: User
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: SIGNAL 6 Abort trap: 6
Terminating Process: JWPlayerTest [39796]
Triggered by Thread: 21
Last Exception Backtrace:
0 CoreFoundation 0x1804b9100 __exceptionPreprocess + 160
1 libobjc.A.dylib 0x180092da8 objc_exception_throw + 72
2 AVFCore 0x1d7a660c8 -[AVPlayerItem(AVPlayerItemOutputs) addOutput:] + 512
3 JWPlayerKit 0x10386282c 0x1036f0000 + 1517612
4 JWPlayerKit 0x1037cdb1c 0x1036f0000 + 908060
5 libdispatch.dylib 0x18017b314 _dispatch_call_block_and_release + 24
6 libdispatch.dylib 0x18017cc08 _dispatch_client_callout + 16
7 libdispatch.dylib 0x180184da0 _dispatch_lane_serial_drain + 976
8 libdispatch.dylib 0x180185924 _dispatch_lane_invoke + 388
9 libdispatch.dylib 0x180191038 _dispatch_root_queue_drain_deferred_wlh + 276
10 libdispatch.dylib 0x180190694 _dispatch_workloop_worker_thread + 440
11 libsystem_pthread.dylib 0x102f3ab88 _pthread_wqthread + 288
12 libsystem_pthread.dylib 0x102f3998c start_wqthread + 8
Kernel Triage:
VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter
VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter
Thread 0:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x102fb8b70 mach_msg2_trap + 8
1 libsystem_kernel.dylib 0x102fc9fac mach_msg2_internal + 72
2 libsystem_kernel.dylib 0x102fc0c28 mach_msg_overwrite + 480
3 libsystem_kernel.dylib 0x102fb8ed8 mach_msg + 20
4 CoreFoundation 0x18041cae0 __CFRunLoopServiceMachPort + 156
5 CoreFoundation 0x180417008 __CFRunLoopRun + 1160
6 CoreFoundation 0x180416704 CFRunLoopRunSpecific + 552
7 GraphicsServices 0x190604b10 GSEventRunModal + 160
8 UIKitCore 0x185b39180 -[UIApplication _run] + 796
9 UIKitCore 0x185b3d378 UIApplicationMain + 124
10 JWPlayerTest.debug.dylib 0x1055bcce0 __debug_main_executable_dylib_entry_point + 64 (AppDelegate.swift:6)
11 ??? 0x1030d1410 ???
12 dyld 0x10328eb98 start + 6076
Thread 1:: Dispatch queue: com.apple.coremedia.fadcdeferredremovepropertylistener
0 CoreAudio 0x1825a236c HALObjectMap::CopyObjectByObjectID(unsigned int) + 0
1 CoreAudio 0x18232ba70 AudioObjectRemovePropertyListener + 100
2 CoreMedia 0x18afd7fa4 __fadcDeferRemovePropertyListeners_block_invoke + 64
3 libdispatch.dylib 0x18017b314 _dispatch_call_block_and_release + 24
4 libdispatch.dylib 0x18017cc08 _dispatch_client_callout + 16
5 libdispatch.dylib 0x180184da0 _dispatch_lane_serial_drain + 976
6 libdispatch.dylib 0x180185924 _dispatch_lane_invoke + 388
7 libdispatch.dylib 0x180191038 _dispatch_root_queue_drain_deferred_wlh + 276
8 libdispatch.dylib 0x180190694 _dispatch_workloop_worker_thread + 440
9 libsystem_pthread.dylib 0x102f3ab88 _pthread_wqthread + 288
10 libsystem_pthread.dylib 0x102f3998c start_wqthread + 8