-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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] Update native Video block to check if MediaPlaceholder should be displayed #49858
Conversation
Size Change: -171 B (0%) Total Size: 1.37 MB
ℹ️ View Unchanged
|
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.
Thanks for putting this together! The test plan succeeded when using a iPhone SE and Samsung Galaxy S20 FE 5G.
I left a comment for us to consider before merging.
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.
Looks good! Thank you. I tested each Video block media selection option with an iPhone SE and Samsung Galaxy S20 FE 5G, I did not encounter any regressions.
What?
Related:
Fixes:
Updates a conditional on the native Video block to determine if a video source exists in order to display MediaPlaceholder under the correct logic.
Why?
Currently, the web and native versions of the Video block use different properties to determine if the MediaPlaceholder component should be displayed:
gutenberg/packages/block-library/src/video/edit.js
Lines 142 to 145 in 4ed1c11
gutenberg/packages/block-library/src/video/edit.native.js
Lines 239 to 242 in 4ed1c11
Although the edit.native.js Video block file is setting the
id
attribute to be the new video URL here, the web equivalent edit.js file does not set theid
as the URL. In fact, it sets theid
andposter
attributes asundefined
:Currently, when a user adds a video from a URL via mobile and saves the post, no placeholder image will be displayed. The lack of an id results in the display of the early return function in the native file, and perceived content loss for the user, even though the video will be displayed correctly on the web editor and on the post itself. Further detail referenced here: #42515 (comment)
How?
To preserve the web behavior and also eliminate the perceived content loss on mobile, this PR modifies the logic of the early return function to check for a
src
attribute as well, which matches the web behavior more closely.Testing Instructions
To test #42515: Saving a Video block with a file URL displays placeholder text in the editor
http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerFun.mp4
To test #42443: Showing the play button after inserting URL that doesn't exist
aaaaaa
Placeholder vs Poster image
Note: this change will allow the mobile app to display a placeholder image, which is distinct from a poster image. The placeholder image will always be the first frame from a given video source URL. A poster image is a specific frame of a video that can be selected from the web editor. Currently, the mobile editor does not allow a user to select the poster image, or display the selected poster image. That work is captured in a separate issue:
Also note that when testing this issue with the common community example of using Big Buck Bunny as a test source, the first frame of Big Buck Bunny is a black screen, and is what will be displayed as the placeholder image. To test with a video URL example that does not have a black screen as the first frame, the following URL can be used:
Screenshots or screencast
Before ❌
Video.Block.Not.Working.mov
After ✅
Video.Block.Working.mov