Plumb presence token refresh through to the app - #57
Conversation
Adds the RN-side half of TPStreamsAndroidPlayer/iOSPlayerSDK's new onPresenceTokenExpired callback, mirroring exactly how onAccessTokenExpired is already threaded through: native emits a direct event (onPresenceTokenExpired, via TPStreamsPlayerViewNativeComponent's Fabric codegen), the JS layer awaits the app's callback and resolves it back via a new Command (setNewPresenceToken). No heartbeat logic lives here — that's entirely internal to the native players now, automatic on play/pause. This is only the request/response plumbing for the one thing that needs the app's help: getting a fresh token on a 401. Android: TPStreamsRNPlayerView.kt/ViewManager.kt add the event constant, listener override, and Command handler exactly parallel to the access-token versions. The manager interface these implement (TPStreamsRNPlayerViewManagerInterface) is Fabric-codegen output from TPStreamsPlayerViewNativeComponent.ts, regenerated automatically at build time (not committed here, unlike Flutter's Pigeon) — the updated spec is what makes setNewPresenceToken exist on it. iOS: TPStreamsRNPlayerView.swift did not have TPStreamPlayerViewController's delegate wired to anything before this — playerVC.delegate was never set, so there was no way to reach the new presenceTokenExpired hook. Set it and added conformance to TPStreamPlayerViewControllerDelegate; the four full-screen callbacks it requires (no default body, unlike presenceTokenExpired) are left as no-ops rather than newly surfacing full-screen events RN did not have before. Left the pre-existing onAccessTokenExpired/TokenRequestDelegate path (a separate, DRM-license-renewal-specific mechanism) untouched. Verified for real: yarn typecheck and yarn test both pass (Node 16.15.0, yarn invoked directly via .yarn/releases/yarn-3.6.1.cjs since no yarn binary is on PATH here). yarn lint fails on a pre-existing environment mismatch unrelated to this change (its ESLint config needs Node 17+'s structuredClone; nothing here touches lint config). Could not verify the native Kotlin/Swift/ObjC++ — no Android/Xcode toolchain in this environment, and both are additionally blocked on the native SDK dependency pins (TPStreamsAndroidPlayer 1.2.6, TPStreamsSDK 1.2.36), which predate the presence APIs entirely. Left TODO comments at both pins rather than guessing a future version number.
|
Claude finished @dhinesh-kumar-m's task in 3m 58s —— View job Reviewing PR #57: Plumb presence token refresh through to the appTodo List
SummaryReviewed the full diff against Blocking issues found:
Non-blocking observations:
Regression AssessmentNo impact on existing playback, DRM, downloads, seeking, track selection, or other public APIs — this is purely additive (new optional prop, new command, new event). The only regression risk is the build-breakage described in finding #2, and the iOS delegate wiring fix ( Final Verdict❌ CHANGES REQUESTED The Android and JS/TS work is solid and consistent with existing conventions, but the iOS command wiring is incomplete (finding #1) and the PR is not safe to merge into |
Summary
onPresenceTokenExpiredprop andsetNewPresenceTokencommand, mirroring the existingonAccessTokenExpired/setNewAccessTokenpattern, so RN apps can resolve a fresh presence token on a 401 from the native heartbeat loop.TPStreamsRNPlayerView.kt,TPStreamsRNPlayerViewManager.kt): wiresTPStreamsPlayer.Listener.onPresenceTokenExpired, exports the event, adds thesetNewPresenceTokencommand.TPStreamsRNPlayerView.swift,TPStreamsRNPlayerViewManager.m): discoveredplayerVC.delegatewas never being set — added it, plus aTPStreamPlayerViewControllerDelegateconformance with the 4 required no-op fullscreen methods and a realpresenceTokenExpired(forVideo:completion:)implementation.TPStreamsPlayer.tsx,TPStreamsPlayerViewNativeComponent.ts): new prop type, event handler, command wiring. If the app doesn't setonPresenceTokenExpired, we resolve with''by default (matches the native side's own backoff-not-hang default) instead of leaving the native callback dangling.TPStreamsAndroidPlayer#feat/presence-sdk-integrationandiOSPlayerSDK#170, which need to merge and ship first.Verification
yarn install— cleanyarn typecheck— passesyarn test— passes (existing stub test suite)yarn lint— pre-existing failure (structuredClone is not defined, Node 16 vs ESLint config needing 17+), unrelated to this changeNot done here
TPStreamsAndroidPlayer/TPStreamsSDKreleases containing the presence changes — those are still in review (see linked PRs).Related: testpress/TPStreamsAndroidPlayer#feat/presence-sdk-integration, testpress/iOSPlayerSDK#170