-
Notifications
You must be signed in to change notification settings - Fork 849
[RNMobile] Initial support for VideoPress v5 #35637
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
3b4fe9b
feat: Enable usage of v5's editor component
SiobhyB 07a7b96
docs: Add changelog entry
SiobhyB ea3a0a9
feat: Dupe Video block for basis of v5 support
SiobhyB f5e9233
feat: Fetch VideoPress metadata in edit component
SiobhyB 79b062d
fix: Ensure plays inline toggle works as expected
SiobhyB 6c8d50e
fix: Remove typo in settings component
SiobhyB 87db30a
refactor: Update logic for fetching video's URL
SiobhyB a5d7df8
feat: Ensure poster displays in thumbnail
SiobhyB 9fecddc
fix: Ensure isUploadFailed state is always correct
SiobhyB 92904ee
feat: Show activity indicator if video's uploading
SiobhyB 1aa07e5
refactor: Ensure fetchMetadata logic is correct
SiobhyB 1b98f61
refactor: Call poster directly, no redundant var
SiobhyB b4d689c
fix: Return early if GUID is falsey, avoid crash
SiobhyB 7804db2
refactor: Tidy up consts for improved readability
SiobhyB 85a30ac
refactor: Replace inline styles with object ref
SiobhyB 11a8a8a
refactor: Pass token to support private sites
SiobhyB 6c5e18b
Merge branch 'trunk' into rnmobile/support-for-videopress-v5
SiobhyB ce02a7c
fix: Return URL for non-VideoPress videos
SiobhyB ae25e26
Merge branch 'trunk' into rnmobile/support-for-videopress-v5
SiobhyB 1955fc1
fix: Ensure failed state is reset when users retry
SiobhyB 95a7277
refactor: Tweaks to allow reusing translations
SiobhyB f1ae7fb
refactor: Align id definition with the video block
SiobhyB e1de824
feat: Enable embed block convert after URL insert
SiobhyB e88d3d4
refactor: Fix missing period at end of sentence
SiobhyB File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
projects/plugins/jetpack/changelog/rnmobile-support-for-videopress-v5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| Significance: patch | ||
| Type: other | ||
|
|
||
| RNMobile: Enable support for editing v5 of the VideoPress block in the Jetpack app. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,3 +15,5 @@ export const VIDEO_PRIVACY = { | |
| PRIVATE: 1, | ||
| SITE_DEFAULT: 2, | ||
| }; | ||
|
|
||
| export const DEFAULT_EMBED_BLOCK = 'core/embed'; | ||
88 changes: 88 additions & 0 deletions
88
projects/plugins/jetpack/extensions/blocks/videopress/edit-common-settings.native.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| /** | ||
| * WordPress dependencies | ||
| */ | ||
| import { ToggleControl, SelectControl } from '@wordpress/components'; | ||
| import { useMemo, useCallback } from '@wordpress/element'; | ||
| import { __, _x } from '@wordpress/i18n'; | ||
|
|
||
| const options = [ | ||
| { value: 'auto', label: _x( 'Auto', 'VideoPress preload setting', 'jetpack' ) }, | ||
| { | ||
| value: 'metadata', | ||
| label: _x( 'Metadata', 'VideoPress preload setting', 'jetpack' ), | ||
| }, | ||
| { value: 'none', label: _x( 'None', 'VideoPress preload setting', 'jetpack' ) }, | ||
| ]; | ||
|
|
||
| const VideoSettings = ( { setAttributes, attributes } ) => { | ||
| const { autoplay, controls, loop, muted, playsinline, preload } = attributes; | ||
|
|
||
| const toggleFactory = useMemo( () => { | ||
| const toggleAttribute = attribute => { | ||
| return newValue => { | ||
| setAttributes( { [ attribute ]: newValue } ); | ||
| }; | ||
| }; | ||
|
|
||
| return { | ||
| autoplay: toggleAttribute( 'autoplay' ), | ||
| loop: toggleAttribute( 'loop' ), | ||
| muted: toggleAttribute( 'muted' ), | ||
| controls: toggleAttribute( 'controls' ), | ||
| playsinline: toggleAttribute( 'playsinline' ), | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note, the changed capitalisation of |
||
| }; | ||
| }, [ setAttributes ] ); | ||
|
|
||
| const onChangePreload = useCallback( | ||
| value => { | ||
| setAttributes( { preload: value } ); | ||
| }, | ||
| [ setAttributes ] | ||
| ); | ||
|
|
||
| return ( | ||
| <> | ||
| <ToggleControl | ||
| __nextHasNoMarginBottom | ||
| label={ __( 'Autoplay', 'jetpack' ) } | ||
| onChange={ toggleFactory.autoplay } | ||
| checked={ !! autoplay } | ||
| help={ __( 'Autoplay may cause usability issues for some users.', 'jetpack' ) } | ||
| /> | ||
| <ToggleControl | ||
| __nextHasNoMarginBottom | ||
| label={ __( 'Loop', 'jetpack' ) } | ||
| onChange={ toggleFactory.loop } | ||
| checked={ !! loop } | ||
| /> | ||
| <ToggleControl | ||
| __nextHasNoMarginBottom | ||
| label={ __( 'Muted', 'jetpack' ) } | ||
| onChange={ toggleFactory.muted } | ||
| checked={ !! muted } | ||
| /> | ||
| <ToggleControl | ||
| __nextHasNoMarginBottom | ||
| label={ __( 'Playback Controls', 'jetpack' ) } | ||
| onChange={ toggleFactory.controls } | ||
| checked={ !! controls } | ||
| /> | ||
| <ToggleControl | ||
| __nextHasNoMarginBottom | ||
| label={ __( 'Play Inline', 'jetpack' ) } | ||
| onChange={ toggleFactory.playsinline } | ||
| checked={ !! playsinline } | ||
| /> | ||
| <SelectControl | ||
| __nextHasNoMarginBottom | ||
| label={ __( 'Preload', 'jetpack' ) } | ||
| value={ preload } | ||
| onChange={ onChangePreload } | ||
| options={ options } | ||
| hideCancelButton={ true } | ||
| /> | ||
| </> | ||
| ); | ||
| }; | ||
|
|
||
| export default VideoSettings; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the future, it would be interesting if we provide the same settings of the VideoPress block: