muxinc / mux-stats-sdk-avplayer

Mux integration with `AVPlayer` for iOS Native Applications
Apache License 2.0
45 stars 21 forks source link

Crash calling monitorAVPlayerLayer #213

Closed gabors closed 1 year ago

gabors commented 1 year ago

mux-stats-sdk-avplayer 3.4.1

Calling monitorAVPlayerLayer causes the app to crash for any video. This used to work fine with prior mux versions.


*** First throw call stack:
(0x193aee5e0 0x18be67c00 0x193b7eeec 0x193a337a8 0x193b74860 0x1050184b4 0x1083b851c 0x1083b757c 0x108421e84 0x108418614 0x108421bec 0x1083a17c8 0x1086b53a0 0x1083a17c8 0x195d3d89c 0x1962e01a4 0x195d3d358 0x195d3d184 0x195eb3664 0x195eb331c 0x195c990bc 0x195c98854 0x195c97ecc 0x195c7a498 0x195c7a5ac 0x19506a76c 0x105c0eb34 0x105c1efec 0x105c1eba0 0x193a389bc 0x193a356c8 0x193a34e18 0x1d64f95ec 0x195e432fc 0x195e42938 0x104caf77c 0x1b621fd44)
libc++abi: terminating due to uncaught exception of type NSException```
gabors commented 1 year ago

NSInvalidArgumentException: -[MUXSDKCustomerPlayerData playerSoftwareName]: unrecognized selector sent to instance 0x281638ce0 ?, in +[MUXSDKStats monitorAVPlayerLayer:withPlayerName:customerData:automaticErrorTracking:beaconCollectionDomain:beaconDomain:] File "VideoAnalyticsManager.swift", line 86, in VideoAnalyticsManager.setupMux File "", in VideoAnalyticsManager.setupMux File "VideoAnalyticsManager.swift", line 19, in VideoAnalyticsManager.track File "PlayerManager.swift", line 542, in PlayerManager.createAVPlayer ... (32 additional frame(s) were not displayed)

daytime-em commented 1 year ago

Hi, thank you for your report.

We are investigating and should have a fix soon.

daytime-em commented 1 year ago

Hello again, @gabors

I think I was able to fix this on our end (missing git tag). Can you try updating your Mux lib again and seeing if that fixes the issue?

gabors commented 1 year ago

Hi @daytime-em

Thanks for jumping on this. I'm using SPM. What version should I update to? Or tag?

daytime-em commented 1 year ago

Anytime, @gabors !

If you're using SPM, please try updating MuxCore to 4.6.0. The package versions should be MuxCore 4.6.0 and MUXSDKStats 3.4.1

If that doesn't work, let me know, I'll keep digging!

gabors commented 1 year ago

@daytime-em Since I am using SPM, MUXSDKStats pulls in whatever version of MuxCore is specified in the Package.swift file. How do I procede?

daytime-em commented 1 year ago

@gabors I wasn't sure if you were building an SPM package yourself, or an xcodeproj so I gave instructions for both:

SPM via Xcode:

You should be able to alt-click on the packages in your project navigator and update them. Maybe first, try clearing the package cache, since there might be bad data cached there.

Clear the package cache:

Screenshot 2023-10-23 at 4 43 45 PM

Update the packages (even if they're already updated)

Screenshot 2023-10-23 at 4 42 05 PM

If you are still seeing this crash afterward, can you paste your Package.resolved*?

cat YOUR-PROJECT.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved 

SPM via your own SPM Package:

Can you delete your Package.resovled and regenerate it?

If that doesn't work would you mind pasting it here?*

gabors commented 1 year ago

I am not building an SPM package myself.

Thanks, I have reset the package cache and force updated the MuxCode to 4.6.0 and testing now. So far so good for online and offline playback. Testing a bit more.

andrewjl-mux commented 1 year ago

Hey @gabors, quick update on our investigation here:

The Package.swift for v3.4.1 specified a relaxed version range for the MuxCore dependency. This let SPM resolve MuxCore to either v4.5.2 or v4.6.0, whereas only the latter v4.6.0 MuxCore should be used with the v3.4.1 MUXSDKStats.

I suspect SPM initially resolving to v4.5.2 was the root cause behind the unrecognized playerSoftwareName selector crash. That selector only became available starting with v4.6.0. We'll be releasing a new v3.4.2 version that fixes this by pinning to the right MuxCore version.

However in the meantime, as long as you're using MuxCore v4.6.0, you shouldn't come across this crash again.

Thank you for reporting this!

daytime-em commented 1 year ago

Closing this one out.

@gabors Thanks again for the report, and let us know if this pops up again!