From e4c1352254e3d5fd54a99b62e0a72bb4df7f9bc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20Dr=C3=B3=C5=BCd=C5=BC?= <31368152+behenate@users.noreply.github.com> Date: Wed, 27 Mar 2024 12:22:50 +0100 Subject: [PATCH] [expo-video] Add `expo-video` docs page (#27854) # Why Expo-video is missing a docs page. ENG-11349 # How Renamed the `video.mdx` to `video-av.mdx` and assigned `video.mdx` as `expo-video` docs page. We should consider doing this the other way around (adding a suffix to `expo-video` file). Current way might create issues with linking to the docs, eg. if someone wants to redirect people to the latest `expo-av` video docs so they would link to `https://docs.expo.dev/versions/latest/sdk/video/`, but the users will be redirected to `expo-video` docs after SDK 51. I kept it this way in case we believe people should be redirected to `expo-video` anyways. Let me know what you think about it :) Created a simple example for `expo-video` (similar to the `expo-av` example), which showcases how to use player properties and events. # Test Plan Tested by running the docs locally --- .../plugins/api/APISectionUtils.tsx | 1 + docs/pages/versions/unversioned/sdk/av.mdx | 4 +- .../versions/unversioned/sdk/video-av.mdx | 98 +++++++++++++++++ docs/pages/versions/unversioned/sdk/video.mdx | 101 ++++++++++-------- .../data/unversioned/expo-video-av.json | 1 + .../static/data/unversioned/expo-video.json | 2 +- packages/expo-video/CHANGELOG.md | 1 + packages/expo-video/build/VideoView.d.ts | 16 ++- packages/expo-video/build/VideoView.d.ts.map | 2 +- packages/expo-video/build/VideoView.js | 18 ++-- packages/expo-video/build/VideoView.js.map | 2 +- .../expo-video/build/VideoView.types.d.ts | 17 ++- .../expo-video/build/VideoView.types.d.ts.map | 2 +- .../expo-video/build/VideoView.types.js.map | 2 +- packages/expo-video/build/VideoView.web.d.ts | 6 +- .../expo-video/build/VideoView.web.d.ts.map | 2 +- .../expo-video/build/VideoView.web.js.map | 2 +- packages/expo-video/build/index.d.ts | 2 +- packages/expo-video/build/index.d.ts.map | 2 +- packages/expo-video/build/index.js.map | 2 +- packages/expo-video/src/VideoView.tsx | 23 ++-- packages/expo-video/src/VideoView.types.ts | 20 ++-- packages/expo-video/src/VideoView.web.tsx | 6 +- packages/expo-video/src/index.ts | 7 +- tools/src/commands/GenerateDocsAPIData.ts | 3 +- 25 files changed, 240 insertions(+), 102 deletions(-) create mode 100644 docs/pages/versions/unversioned/sdk/video-av.mdx create mode 100644 docs/public/static/data/unversioned/expo-video-av.json diff --git a/docs/components/plugins/api/APISectionUtils.tsx b/docs/components/plugins/api/APISectionUtils.tsx index 8f763073f7270..b7a0106b80885 100644 --- a/docs/components/plugins/api/APISectionUtils.tsx +++ b/docs/components/plugins/api/APISectionUtils.tsx @@ -123,6 +123,7 @@ const nonLinkableTypes = [ 'NativeSyntheticEvent', 'ParsedQs', 'ServiceActionResult', + 'SharedObject', 'T', 'TaskOptions', 'Uint8Array', diff --git a/docs/pages/versions/unversioned/sdk/av.mdx b/docs/pages/versions/unversioned/sdk/av.mdx index 55bf4c91dee1b..6dd0efdafadaf 100644 --- a/docs/pages/versions/unversioned/sdk/av.mdx +++ b/docs/pages/versions/unversioned/sdk/av.mdx @@ -16,7 +16,7 @@ import { } from '~/components/plugins/ConfigSection'; import { AndroidPermissions, IOSPermissions } from '~/components/plugins/permissions'; -The [`Audio.Sound`](audio.mdx) objects and [`Video`](video.mdx) components share a unified imperative API for media playback. +The [`Audio.Sound`](audio.mdx) objects and [`Video`](video-av.mdx) components share a unified imperative API for media playback. Note that for `Video`, all of the operations are also available via props on the component. However, we recommend using this imperative playback API for most applications where finer control over the state of the video playback is needed. @@ -108,7 +108,7 @@ render() { } ``` -See the [video documentation](video.mdx) for further information. +See the [video documentation](video-av.mdx) for further information. ### Example: `setOnPlaybackStatusUpdate()` diff --git a/docs/pages/versions/unversioned/sdk/video-av.mdx b/docs/pages/versions/unversioned/sdk/video-av.mdx new file mode 100644 index 0000000000000..c5d1690f169ab --- /dev/null +++ b/docs/pages/versions/unversioned/sdk/video-av.mdx @@ -0,0 +1,98 @@ +--- +title: Video (expo-av) +description: A library that provides an API to implement video playback and recording in apps. +sourceCodeUrl: 'https://github.com/expo/expo/tree/main/packages/expo-av' +packageName: 'expo-av' +iconUrl: '/static/images/packages/expo-av.png' +platforms: ['android', 'ios', 'web'] +--- + +import APISection from '~/components/plugins/APISection'; +import { APIInstallSection } from '~/components/plugins/InstallSection'; +import { SnackInline } from '~/ui/components/Snippet'; + +> **info** The `Video` component from expo-av, which is documented on this page, will be replaced by an improved version in `expo-video` in an upcoming release when the new library is stable. [Learn about `expo-video`](video.mdx). + +The `Video` component from `expo-av` displays a video inline with the other UI elements in your app. + +Much of Video and Audio have common APIs that are documented in [AV documentation](av.mdx). This page covers video-specific props and APIs. We encourage you to skim through this document to get basic video working, and then move on to [AV documentation](av.mdx) for more advanced functionality. The audio experience of video (such as whether to interrupt music already playing in another app, or whether to play sound while the phone is on silent mode) can be customized using the [Audio API](audio.mdx). + +## Installation + + + +## Usage + +Here's a simple example of a video with a play/pause button. + + + +```jsx +import * as React from 'react'; +import { View, StyleSheet, Button } from 'react-native'; +import { Video, ResizeMode } from 'expo-av'; + +export default function App() { + const video = React.useRef(null); + const [status, setStatus] = React.useState({}); + return ( + +