wordpress-mobile / gutenberg-mobile

Mobile version of Gutenberg - native iOS and Android
GNU General Public License v2.0
240 stars 55 forks source link

Able to choose multiple videos from Media library for VideoPress block, only one uses VP block (Android only) #5757

Open lmischner opened 1 year ago

lmischner commented 1 year ago

Describe the bug When either replacing a video in a VP block or initially adding one, if you choose to select the video from the WordPress Media Library, then you're able to choose multiple videos. Only the first one uses the VP block (the others use the Video block).

To Reproduce Steps to reproduce the behavior:

  1. Add a new VideoPress block
  2. Add video from the WordPress Media Library
  3. Choose more than 1 before tapping the checkmark
  4. Note behavior of selected videos in the post

Expected behavior In iOS, we can only select one video. If we can select multiple, I'd expect them all to use the same block type.

Screenshots

https://github.com/wordpress-mobile/gutenberg-mobile/assets/103850310/85a25045-a4c5-4a0e-83ab-7c558b4a4aed

Smartphone (please complete the following information):

fluiddot commented 1 year ago

Not sure if this is by design but seems that adding media items works differently by platform. On iOS, in most cases, we only allow single items. Nevertheless on Android, when adding items from the WP media library, we always allow multiple.

The flow for Android when selecting multiple WP media items works this way:

  1. The first element is inserted in the current block.
  2. The rest of the items are sent to the editor via the mediaAppend bridge event. They are processed by the editor here. As you can see, the media are converted to blocks just by checking the media type.

The above flow won't work for VideoPress videos, so we need to figure out to expand that logic. Alternatively, we could disable this functionality only for the VideoPress block.