triniwiz / nativescript-plugins

Apache License 2.0
80 stars 50 forks source link

'playsInLine' is problematic on iOS and unavailable on Android #94

Open chris-praxis opened 2 years ago

chris-praxis commented 2 years ago

The Good With playsInLine="true" on iOS, my app waits until player is ready, then allows user to tap to play. A black, fullscreen view opens and video plays.

Problem 1: no auto-close and multiple taps required If I allow it to play through then view remains until user closes it. User must tap once to show controls, then tap [X] to close. App knows when when video plays to end (EOF) but there is no API call to close the view.

Problem 2: black screen, double-close If user taps to show controls and then taps [X] during playback, video appears to animate away but black/empty view remains until user taps [X] again.

Problem 3: inconsistent re-play behavior If user toggles view by closing and re-playing, every other 'play' will re-start playback where it left off, but on every other 'play' video will be paused (playback does not continue). App is also limited because it doesn't know when view closes.

Problem 4: documentation 'playsInLine' is marked (checked) for Android in the doc here... https://triniwiz.github.io/nativescript-plugins/api-reference/youtube-player.html#api ...but the underlying feature is not supported on Android... https://developers.google.com/youtube/player_parameters#playsinline

chris-praxis commented 2 years ago

For Problem 3, I tried calling 'stop' prior to 'play' so that video will always start from the beginning. This works when running in Xcode but crashes via "ns run ios". I see this: [assertion] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=3 "Required client entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"MediaPlayback" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Required client entitlement is missing}>