-
Notifications
You must be signed in to change notification settings - Fork 385
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
Enable playing the Core Video block's video in the editor #2799
Conversation
Ideally, this would just extend that component, and override the render() method. But that caused a console warning.
// Set the block's src from the edit component's state, and switch off | ||
// the editing UI. | ||
if ( newSrc !== src ) { | ||
// Omit the embed block logic, as that didn't seem to work. |
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.
Before, entering an embed URL below 'Insert from URL' was supposed to create an Embed block:
This is intentionally disabled for YouTube, but even other embeds like Vimeo don't seem to display.
Is it OK that I removed the logic to convert to embeds?
Entering a non-embed URL still works. But embed support will probably require copying a lot of other dependencies, like createUpgradedEmbedBlock(), making this file much longer.
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.
Is it OK that I removed the logic to convert to embeds?
I suppose so. AMP Stories doesn't really support any external providers AFAIK.
cc @westonruter
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.
AMP Story should support Twitter embed in theory.
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.
Pasting a tweet URL in a video block and converting it to a twitter embed would be a bit unexpected, no?
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.
True 😄 My comment was a bit out of context.
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.
External video providers aren't supported yet, but support is planned soon: ampproject/amphtml#15847
assets/src/stories-editor/components/video-block-edit-with-preview.js
Outdated
Show resolved
Hide resolved
assets/src/stories-editor/components/video-block-edit-with-preview.js
Outdated
Show resolved
Hide resolved
The Video block has a display that shows only the video, and one that allows editing. Before, I thought of letting the original block handle the display for editing. But it looks like that's not possible.
This will probably be important to allow another PR to filter the mediaUpload to only allow certain types.
Request For Review It allows the video in the Core Video block to play in the editor, where it was wrapped in Though this might be overkill, as it forks most of the Core Vide block's edit component. I couldn't figure out a way around this. I tried creating a new class that extends the Video edit component, like: class VideoEditWithPreview extends InitialBlockEdit {
render() {
/* implements render */
}
} Ideally, this would simply override the This caused a console warning that the component should instead extend Maybe there's another way around this that I haven't thought of. Thanks, and have a great weekend! |
<InspectorControls> | ||
<PanelBody title={ __( 'Video Settings' ) }> | ||
<ToggleControl | ||
label={ __( 'Playback Controls' ) } |
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.
Uhm, it doesn't seem like controls are actually displayed in AMP Stories? The runtime seems to hide them no matter what.
@westonruter Can you confirm this? Should we just remove this option?
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.
AFAIK this was already removed at some point.
Found also this: #2255 where controls
was set to false
by default.
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.
Hmm so we should remove the controls
setting, but keep the loop
(default to true) and mute
settings?
Even though mute
doesn't seem to have any effect. When opening an AMP Story, sound is muted by default for the whole story (see upper right corner), and when I enable sound, the video is not muted.
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.
Yep, the mute
control doesn't seem to have any effect anyway, looks like "Loop" is the only control that actually does anything.
Seems like we could probably just add the loop
and leave the rest out for now.
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.
Added back the loop
setting and removed the one for controls
.
If loop
is disabled, controls
are still shown since one might want to re-start the video during editing.
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.
1-2 open questions but otherwise works great.
Video poster images are required. Clicking on the remove button doesn’t work anyway as the stories editor automatically assigns the poster image again.
Since I added some changes, I'd like another pair of eyes do the final review here 🙂 |
@swissspidy, would it help if I reviewed the latest changes? |
@kienstra Sure, but you cannot approve your own PR :-) |
render()
method.Component
instead of the VideoBlockEdit
withVideoPosterImageNotice
logic within the component itself.Closes #2530.
Fixes #2808.