Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

[Video] Add `onEnterFullscreen` and `onExitFullscreen` to `VideoView` (#4907)

* patch expo video to add enter/exit fullscreen events

* rm logs

* Update expo-video+1.2.4.patch.md

authored by

Hailey and committed by
GitHub
0f993a09 cb574b7b

+141 -20
-20
patches/expo-video+1.1.10.patch
··· 1 - --- a/node_modules/expo-video/android/src/main/java/expo/modules/video/PlayerViewExtension.kt 2 - +++ b/node_modules/expo-video/android/src/main/java/expo/modules/video/PlayerViewExtension.kt 3 - @@ -11,6 +11,7 @@ internal fun PlayerView.applyRequiresLinearPlayback(requireLinearPlayback: Boole 4 - setShowPreviousButton(!requireLinearPlayback) 5 - setShowNextButton(!requireLinearPlayback) 6 - setTimeBarInteractive(requireLinearPlayback) 7 - + setShowSubtitleButton(true) 8 - } 9 - 10 - @androidx.annotation.OptIn(androidx.media3.common.util.UnstableApi::class) 11 - @@ -27,7 +28,8 @@ internal fun PlayerView.setTimeBarInteractive(interactive: Boolean) { 12 - 13 - @androidx.annotation.OptIn(androidx.media3.common.util.UnstableApi::class) 14 - internal fun PlayerView.setFullscreenButtonVisibility(visible: Boolean) { 15 - - val fullscreenButton = findViewById<android.widget.ImageButton>(androidx.media3.ui.R.id.exo_fullscreen) 16 - + val fullscreenButton = 17 - + findViewById<android.widget.ImageButton>(androidx.media3.ui.R.id.exo_fullscreen) 18 - fullscreenButton?.visibility = if (visible) { 19 - android.view.View.VISIBLE 20 - } else {
+135
patches/expo-video+1.2.4.patch
··· 1 + diff --git a/node_modules/expo-video/android/src/main/java/expo/modules/video/PlayerViewExtension.kt b/node_modules/expo-video/android/src/main/java/expo/modules/video/PlayerViewExtension.kt 2 + index 9905e13..47342ff 100644 3 + --- a/node_modules/expo-video/android/src/main/java/expo/modules/video/PlayerViewExtension.kt 4 + +++ b/node_modules/expo-video/android/src/main/java/expo/modules/video/PlayerViewExtension.kt 5 + @@ -11,6 +11,7 @@ internal fun PlayerView.applyRequiresLinearPlayback(requireLinearPlayback: Boole 6 + setShowPreviousButton(!requireLinearPlayback) 7 + setShowNextButton(!requireLinearPlayback) 8 + setTimeBarInteractive(requireLinearPlayback) 9 + + setShowSubtitleButton(true) 10 + } 11 + 12 + @androidx.annotation.OptIn(androidx.media3.common.util.UnstableApi::class) 13 + @@ -27,7 +28,8 @@ internal fun PlayerView.setTimeBarInteractive(interactive: Boolean) { 14 + 15 + @androidx.annotation.OptIn(androidx.media3.common.util.UnstableApi::class) 16 + internal fun PlayerView.setFullscreenButtonVisibility(visible: Boolean) { 17 + - val fullscreenButton = findViewById<android.widget.ImageButton>(androidx.media3.ui.R.id.exo_fullscreen) 18 + + val fullscreenButton = 19 + + findViewById<android.widget.ImageButton>(androidx.media3.ui.R.id.exo_fullscreen) 20 + fullscreenButton?.visibility = if (visible) { 21 + android.view.View.VISIBLE 22 + } else { 23 + diff --git a/node_modules/expo-video/android/src/main/java/expo/modules/video/VideoModule.kt b/node_modules/expo-video/android/src/main/java/expo/modules/video/VideoModule.kt 24 + index ec3da2a..5a1397a 100644 25 + --- a/node_modules/expo-video/android/src/main/java/expo/modules/video/VideoModule.kt 26 + +++ b/node_modules/expo-video/android/src/main/java/expo/modules/video/VideoModule.kt 27 + @@ -43,7 +43,9 @@ class VideoModule : Module() { 28 + View(VideoView::class) { 29 + Events( 30 + "onPictureInPictureStart", 31 + - "onPictureInPictureStop" 32 + + "onPictureInPictureStop", 33 + + "onEnterFullscreen", 34 + + "onExitFullscreen" 35 + ) 36 + 37 + Prop("player") { view: VideoView, player: VideoPlayer -> 38 + diff --git a/node_modules/expo-video/android/src/main/java/expo/modules/video/VideoView.kt b/node_modules/expo-video/android/src/main/java/expo/modules/video/VideoView.kt 39 + index a951d80..3932535 100644 40 + --- a/node_modules/expo-video/android/src/main/java/expo/modules/video/VideoView.kt 41 + +++ b/node_modules/expo-video/android/src/main/java/expo/modules/video/VideoView.kt 42 + @@ -36,6 +36,8 @@ class VideoView(context: Context, appContext: AppContext) : ExpoView(context, ap 43 + val playerView: PlayerView = PlayerView(context.applicationContext) 44 + val onPictureInPictureStart by EventDispatcher<Unit>() 45 + val onPictureInPictureStop by EventDispatcher<Unit>() 46 + + val onEnterFullscreen by EventDispatcher() 47 + + val onExitFullscreen by EventDispatcher() 48 + 49 + var willEnterPiP: Boolean = false 50 + var isInFullscreen: Boolean = false 51 + @@ -154,6 +156,7 @@ class VideoView(context: Context, appContext: AppContext) : ExpoView(context, ap 52 + @Suppress("DEPRECATION") 53 + currentActivity.overridePendingTransition(0, 0) 54 + } 55 + + onEnterFullscreen(mapOf()) 56 + isInFullscreen = true 57 + } 58 + 59 + @@ -162,6 +165,7 @@ class VideoView(context: Context, appContext: AppContext) : ExpoView(context, ap 60 + val fullScreenButton: ImageButton = playerView.findViewById(androidx.media3.ui.R.id.exo_fullscreen) 61 + fullScreenButton.setImageResource(androidx.media3.ui.R.drawable.exo_icon_fullscreen_enter) 62 + videoPlayer?.changePlayerView(playerView) 63 + + this.onExitFullscreen(mapOf()) 64 + isInFullscreen = false 65 + } 66 + 67 + diff --git a/node_modules/expo-video/build/VideoView.types.d.ts b/node_modules/expo-video/build/VideoView.types.d.ts 68 + index cb9ca6d..60e9f4e 100644 69 + --- a/node_modules/expo-video/build/VideoView.types.d.ts 70 + +++ b/node_modules/expo-video/build/VideoView.types.d.ts 71 + @@ -89,5 +89,8 @@ export interface VideoViewProps extends ViewProps { 72 + * @platform ios 16.0+ 73 + */ 74 + allowsVideoFrameAnalysis?: boolean; 75 + + 76 + + onEnterFullscreen?: () => void; 77 + + onExitFullscreen?: () => void; 78 + } 79 + //# sourceMappingURL=VideoView.types.d.ts.map 80 + diff --git a/node_modules/expo-video/ios/VideoModule.swift b/node_modules/expo-video/ios/VideoModule.swift 81 + index c537a12..e4a918f 100644 82 + --- a/node_modules/expo-video/ios/VideoModule.swift 83 + +++ b/node_modules/expo-video/ios/VideoModule.swift 84 + @@ -16,7 +16,9 @@ public final class VideoModule: Module { 85 + View(VideoView.self) { 86 + Events( 87 + "onPictureInPictureStart", 88 + - "onPictureInPictureStop" 89 + + "onPictureInPictureStop", 90 + + "onEnterFullscreen", 91 + + "onExitFullscreen" 92 + ) 93 + 94 + Prop("player") { (view, player: VideoPlayer?) in 95 + diff --git a/node_modules/expo-video/ios/VideoView.swift b/node_modules/expo-video/ios/VideoView.swift 96 + index f4579e4..10c5908 100644 97 + --- a/node_modules/expo-video/ios/VideoView.swift 98 + +++ b/node_modules/expo-video/ios/VideoView.swift 99 + @@ -41,6 +41,8 @@ public final class VideoView: ExpoView, AVPlayerViewControllerDelegate { 100 + 101 + let onPictureInPictureStart = EventDispatcher() 102 + let onPictureInPictureStop = EventDispatcher() 103 + + let onEnterFullscreen = EventDispatcher() 104 + + let onExitFullscreen = EventDispatcher() 105 + 106 + public override var bounds: CGRect { 107 + didSet { 108 + @@ -163,6 +165,7 @@ public final class VideoView: ExpoView, AVPlayerViewControllerDelegate { 109 + _ playerViewController: AVPlayerViewController, 110 + willBeginFullScreenPresentationWithAnimationCoordinator coordinator: UIViewControllerTransitionCoordinator 111 + ) { 112 + + onEnterFullscreen() 113 + isFullscreen = true 114 + } 115 + 116 + @@ -179,6 +182,7 @@ public final class VideoView: ExpoView, AVPlayerViewControllerDelegate { 117 + if wasPlaying { 118 + self.player?.pointer.play() 119 + } 120 + + self.onExitFullscreen() 121 + self.isFullscreen = false 122 + } 123 + } 124 + diff --git a/node_modules/expo-video/src/VideoView.types.ts b/node_modules/expo-video/src/VideoView.types.ts 125 + index 29fe5db..e1fbf59 100644 126 + --- a/node_modules/expo-video/src/VideoView.types.ts 127 + +++ b/node_modules/expo-video/src/VideoView.types.ts 128 + @@ -100,4 +100,7 @@ export interface VideoViewProps extends ViewProps { 129 + * @platform ios 16.0+ 130 + */ 131 + allowsVideoFrameAnalysis?: boolean; 132 + + 133 + + onEnterFullscreen?: () => void; 134 + + onExitFullscreen?: () => void; 135 + }
+6
patches/expo-video+1.2.4.patch.md
··· 1 + ## uwu woad beawing, do not wemove 2 + 3 + ## `expo-video` Patch 4 + 5 + This patch adds two props to `VideoView`: `onEnterFullscreen` and `onExitFullscreen` which do exactly what they say on 6 + the tin.