-
Notifications
You must be signed in to change notification settings - Fork 800
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
[RNMobile] Initial support for VideoPress v5 #35637
Merged
Merged
Changes from 12 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
07a7b96
docs: Add changelog entry
ea3a0a9
feat: Dupe Video block for basis of v5 support
f5e9233
feat: Fetch VideoPress metadata in edit component
79b062d
fix: Ensure plays inline toggle works as expected
6c8d50e
fix: Remove typo in settings component
87db30a
refactor: Update logic for fetching video's URL
a5d7df8
feat: Ensure poster displays in thumbnail
9fecddc
fix: Ensure isUploadFailed state is always correct
92904ee
feat: Show activity indicator if video's uploading
1aa07e5
refactor: Ensure fetchMetadata logic is correct
1b98f61
refactor: Call poster directly, no redundant var
b4d689c
fix: Return early if GUID is falsey, avoid crash
7804db2
refactor: Tidy up consts for improved readability
85a30ac
refactor: Replace inline styles with object ref
11a8a8a
refactor: Pass token to support private sites
6c5e18b
Merge branch 'trunk' into rnmobile/support-for-videopress-v5
ce02a7c
fix: Return URL for non-VideoPress videos
ae25e26
Merge branch 'trunk' into rnmobile/support-for-videopress-v5
1955fc1
fix: Ensure failed state is reset when users retry
95a7277
refactor: Tweaks to allow reusing translations
f1ae7fb
refactor: Align id definition with the video block
e1de824
feat: Enable embed block convert after URL insert
e88d3d4
refactor: Fix missing period at end of sentence
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 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. |
85 changes: 85 additions & 0 deletions
85
projects/plugins/jetpack/extensions/blocks/videopress/edit-common-settings.native.js
This file contains 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,85 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { ToggleControl, SelectControl } from '@wordpress/components'; | ||
import { useMemo, useCallback } from '@wordpress/element'; | ||
import { __, _x } from '@wordpress/i18n'; | ||
|
||
const options = [ | ||
{ value: 'auto', label: __( 'Auto', 'jetpack' ) }, | ||
{ value: 'metadata', label: __( 'Metadata', 'jetpack' ) }, | ||
{ value: 'none', label: _x( 'None', 'Preload value', 'jetpack' ) }, | ||
SiobhyB marked this conversation as resolved.
Show resolved
Hide resolved
|
||
]; | ||
|
||
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' ), | ||
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' ) } | ||
fluiddot marked this conversation as resolved.
Show resolved
Hide resolved
|
||
/> | ||
<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' ) } | ||
SiobhyB marked this conversation as resolved.
Show resolved
Hide resolved
|
||
onChange={ toggleFactory.controls } | ||
checked={ !! controls } | ||
/> | ||
<ToggleControl | ||
__nextHasNoMarginBottom | ||
label={ __( 'Play inline', 'jetpack' ) } | ||
SiobhyB marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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.
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: