Skip to content

Conversation

@etoledom
Copy link
Contributor

@etoledom etoledom commented Dec 3, 2020

Gutenberg Mobile wordpress-mobile/gutenberg-mobile#3037
WPAndroid wordpress-mobile/WordPress-Android#13843
WPiOS wordpress-mobile/WordPress-iOS#15694

Description

This PR adds a placeholder-ish Audio Player UI for the Audio Block.

How has this been tested?

  • Add an audio block.
  • Check that the Audio Player UI looks as expected.

Screenshots

Success

Light Mode Dark Mode

Uploading

Light Mode Dark Mode

Error

Light Mode Dark Mode

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR.

@etoledom etoledom added the Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) label Dec 3, 2020
@etoledom etoledom requested a review from jd-alexander December 3, 2020 11:55
@etoledom etoledom self-assigned this Dec 3, 2020
@github-actions
Copy link

github-actions bot commented Dec 3, 2020

Size Change: 0 B

Total Size: 1.37 MB

ℹ️ View Unchanged
Filename Size Change
build/a11y/index.js 1.14 kB 0 B
build/annotations/index.js 3.78 kB 0 B
build/api-fetch/index.js 3.4 kB 0 B
build/autop/index.js 2.84 kB 0 B
build/blob/index.js 665 B 0 B
build/block-directory/index.js 9.08 kB 0 B
build/block-directory/style-rtl.css 1.01 kB 0 B
build/block-directory/style.css 1.01 kB 0 B
build/block-editor/index.js 123 kB 0 B
build/block-editor/style-rtl.css 12 kB 0 B
build/block-editor/style.css 12 kB 0 B
build/block-library/blocks/archives/editor-rtl.css 61 B 0 B
build/block-library/blocks/archives/editor.css 60 B 0 B
build/block-library/blocks/audio/editor-rtl.css 58 B 0 B
build/block-library/blocks/audio/editor.css 58 B 0 B
build/block-library/blocks/audio/style-rtl.css 103 B 0 B
build/block-library/blocks/audio/style.css 103 B 0 B
build/block-library/blocks/block/editor-rtl.css 161 B 0 B
build/block-library/blocks/block/editor.css 161 B 0 B
build/block-library/blocks/button/editor-rtl.css 475 B 0 B
build/block-library/blocks/button/editor.css 474 B 0 B
build/block-library/blocks/button/style-rtl.css 453 B 0 B
build/block-library/blocks/button/style.css 451 B 0 B
build/block-library/blocks/buttons/editor-rtl.css 227 B 0 B
build/block-library/blocks/buttons/editor.css 227 B 0 B
build/block-library/blocks/buttons/style-rtl.css 297 B 0 B
build/block-library/blocks/buttons/style.css 297 B 0 B
build/block-library/blocks/calendar/style-rtl.css 208 B 0 B
build/block-library/blocks/calendar/style.css 208 B 0 B
build/block-library/blocks/categories/editor-rtl.css 84 B 0 B
build/block-library/blocks/categories/editor.css 83 B 0 B
build/block-library/blocks/categories/style-rtl.css 79 B 0 B
build/block-library/blocks/categories/style.css 79 B 0 B
build/block-library/blocks/code/style-rtl.css 90 B 0 B
build/block-library/blocks/code/style.css 90 B 0 B
build/block-library/blocks/columns/editor-rtl.css 190 B 0 B
build/block-library/blocks/columns/editor.css 190 B 0 B
build/block-library/blocks/columns/style-rtl.css 421 B 0 B
build/block-library/blocks/columns/style.css 421 B 0 B
build/block-library/blocks/cover/editor-rtl.css 392 B 0 B
build/block-library/blocks/cover/editor.css 393 B 0 B
build/block-library/blocks/cover/style-rtl.css 1.25 kB 0 B
build/block-library/blocks/cover/style.css 1.25 kB 0 B
build/block-library/blocks/embed/editor-rtl.css 486 B 0 B
build/block-library/blocks/embed/editor.css 486 B 0 B
build/block-library/blocks/embed/style-rtl.css 375 B 0 B
build/block-library/blocks/embed/style.css 375 B 0 B
build/block-library/blocks/file/editor-rtl.css 199 B 0 B
build/block-library/blocks/file/editor.css 198 B 0 B
build/block-library/blocks/file/style-rtl.css 248 B 0 B
build/block-library/blocks/file/style.css 248 B 0 B
build/block-library/blocks/freeform/editor-rtl.css 2.45 kB 0 B
build/block-library/blocks/freeform/editor.css 2.45 kB 0 B
build/block-library/blocks/gallery/editor-rtl.css 679 B 0 B
build/block-library/blocks/gallery/editor.css 679 B 0 B
build/block-library/blocks/gallery/style-rtl.css 1.07 kB 0 B
build/block-library/blocks/gallery/style.css 1.06 kB 0 B
build/block-library/blocks/group/editor-rtl.css 318 B 0 B
build/block-library/blocks/group/editor.css 317 B 0 B
build/block-library/blocks/group/style-rtl.css 57 B 0 B
build/block-library/blocks/group/style.css 57 B 0 B
build/block-library/blocks/heading/editor-rtl.css 129 B 0 B
build/block-library/blocks/heading/editor.css 129 B 0 B
build/block-library/blocks/heading/style-rtl.css 76 B 0 B
build/block-library/blocks/heading/style.css 76 B 0 B
build/block-library/blocks/html/editor-rtl.css 281 B 0 B
build/block-library/blocks/html/editor.css 281 B 0 B
build/block-library/blocks/image/editor-rtl.css 717 B 0 B
build/block-library/blocks/image/editor.css 716 B 0 B
build/block-library/blocks/image/style-rtl.css 477 B 0 B
build/block-library/blocks/image/style.css 478 B 0 B
build/block-library/blocks/latest-comments/editor-rtl.css 159 B 0 B
build/block-library/blocks/latest-comments/editor.css 158 B 0 B
build/block-library/blocks/latest-comments/style-rtl.css 269 B 0 B
build/block-library/blocks/latest-comments/style.css 269 B 0 B
build/block-library/blocks/latest-posts/editor-rtl.css 137 B 0 B
build/block-library/blocks/latest-posts/editor.css 137 B 0 B
build/block-library/blocks/latest-posts/style-rtl.css 523 B 0 B
build/block-library/blocks/latest-posts/style.css 522 B 0 B
build/block-library/blocks/list/editor-rtl.css 65 B 0 B
build/block-library/blocks/list/editor.css 65 B 0 B
build/block-library/blocks/list/style-rtl.css 63 B 0 B
build/block-library/blocks/list/style.css 63 B 0 B
build/block-library/blocks/media-text/editor-rtl.css 191 B 0 B
build/block-library/blocks/media-text/editor.css 191 B 0 B
build/block-library/blocks/media-text/style-rtl.css 535 B 0 B
build/block-library/blocks/media-text/style.css 532 B 0 B
build/block-library/blocks/more/editor-rtl.css 434 B 0 B
build/block-library/blocks/more/editor.css 434 B 0 B
build/block-library/blocks/navigation-link/editor-rtl.css 392 B 0 B
build/block-library/blocks/navigation-link/editor.css 394 B 0 B
build/block-library/blocks/navigation-link/style-rtl.css 704 B 0 B
build/block-library/blocks/navigation-link/style.css 702 B 0 B
build/block-library/blocks/navigation/editor-rtl.css 1.38 kB 0 B
build/block-library/blocks/navigation/editor.css 1.37 kB 0 B
build/block-library/blocks/navigation/style-rtl.css 183 B 0 B
build/block-library/blocks/navigation/style.css 183 B 0 B
build/block-library/blocks/nextpage/editor-rtl.css 395 B 0 B
build/block-library/blocks/nextpage/editor.css 395 B 0 B
build/block-library/blocks/paragraph/editor-rtl.css 109 B 0 B
build/block-library/blocks/paragraph/editor.css 109 B 0 B
build/block-library/blocks/paragraph/style-rtl.css 273 B 0 B
build/block-library/blocks/paragraph/style.css 273 B 0 B
build/block-library/blocks/post-author/editor-rtl.css 209 B 0 B
build/block-library/blocks/post-author/editor.css 209 B 0 B
build/block-library/blocks/post-author/style-rtl.css 183 B 0 B
build/block-library/blocks/post-author/style.css 184 B 0 B
build/block-library/blocks/post-comments-form/style-rtl.css 249 B 0 B
build/block-library/blocks/post-comments-form/style.css 249 B 0 B
build/block-library/blocks/post-content/editor-rtl.css 139 B 0 B
build/block-library/blocks/post-content/editor.css 139 B 0 B
build/block-library/blocks/post-excerpt/editor-rtl.css 73 B 0 B
build/block-library/blocks/post-excerpt/editor.css 73 B 0 B
build/block-library/blocks/post-featured-image/editor-rtl.css 338 B 0 B
build/block-library/blocks/post-featured-image/editor.css 338 B 0 B
build/block-library/blocks/post-featured-image/style-rtl.css 100 B 0 B
build/block-library/blocks/post-featured-image/style.css 100 B 0 B
build/block-library/blocks/preformatted/style-rtl.css 63 B 0 B
build/block-library/blocks/preformatted/style.css 63 B 0 B
build/block-library/blocks/pullquote/editor-rtl.css 183 B 0 B
build/block-library/blocks/pullquote/editor.css 183 B 0 B
build/block-library/blocks/pullquote/style-rtl.css 316 B 0 B
build/block-library/blocks/pullquote/style.css 316 B 0 B
build/block-library/blocks/query-loop/editor-rtl.css 90 B 0 B
build/block-library/blocks/query-loop/editor.css 89 B 0 B
build/block-library/blocks/query-loop/style-rtl.css 315 B 0 B
build/block-library/blocks/query-loop/style.css 317 B 0 B
build/block-library/blocks/query-pagination-numbers/editor-rtl.css 122 B 0 B
build/block-library/blocks/query-pagination-numbers/editor.css 121 B 0 B
build/block-library/blocks/query-pagination/editor-rtl.css 270 B 0 B
build/block-library/blocks/query-pagination/editor.css 262 B 0 B
build/block-library/blocks/query-pagination/style-rtl.css 168 B 0 B
build/block-library/blocks/query-pagination/style.css 168 B 0 B
build/block-library/blocks/query/editor-rtl.css 159 B 0 B
build/block-library/blocks/query/editor.css 160 B 0 B
build/block-library/blocks/quote/editor-rtl.css 61 B 0 B
build/block-library/blocks/quote/editor.css 61 B 0 B
build/block-library/blocks/quote/style-rtl.css 169 B 0 B
build/block-library/blocks/quote/style.css 169 B 0 B
build/block-library/blocks/rss/editor-rtl.css 201 B 0 B
build/block-library/blocks/rss/editor.css 202 B 0 B
build/block-library/blocks/rss/style-rtl.css 290 B 0 B
build/block-library/blocks/rss/style.css 290 B 0 B
build/block-library/blocks/search/editor-rtl.css 165 B 0 B
build/block-library/blocks/search/editor.css 165 B 0 B
build/block-library/blocks/search/style-rtl.css 342 B 0 B
build/block-library/blocks/search/style.css 344 B 0 B
build/block-library/blocks/separator/editor-rtl.css 99 B 0 B
build/block-library/blocks/separator/editor.css 99 B 0 B
build/block-library/blocks/separator/style-rtl.css 236 B 0 B
build/block-library/blocks/separator/style.css 236 B 0 B
build/block-library/blocks/shortcode/editor-rtl.css 504 B 0 B
build/block-library/blocks/shortcode/editor.css 504 B 0 B
build/block-library/blocks/site-logo/editor-rtl.css 201 B 0 B
build/block-library/blocks/site-logo/editor.css 201 B 0 B
build/block-library/blocks/site-logo/style-rtl.css 117 B 0 B
build/block-library/blocks/site-logo/style.css 117 B 0 B
build/block-library/blocks/social-link/editor-rtl.css 164 B 0 B
build/block-library/blocks/social-link/editor.css 165 B 0 B
build/block-library/blocks/social-links/editor-rtl.css 711 B 0 B
build/block-library/blocks/social-links/editor.css 712 B 0 B
build/block-library/blocks/social-links/style-rtl.css 1.37 kB 0 B
build/block-library/blocks/social-links/style.css 1.37 kB 0 B
build/block-library/blocks/spacer/editor-rtl.css 302 B 0 B
build/block-library/blocks/spacer/editor.css 302 B 0 B
build/block-library/blocks/spacer/style-rtl.css 48 B 0 B
build/block-library/blocks/spacer/style.css 48 B 0 B
build/block-library/blocks/subhead/editor-rtl.css 99 B 0 B
build/block-library/blocks/subhead/editor.css 99 B 0 B
build/block-library/blocks/subhead/style-rtl.css 80 B 0 B
build/block-library/blocks/subhead/style.css 80 B 0 B
build/block-library/blocks/table/editor-rtl.css 489 B 0 B
build/block-library/blocks/table/editor.css 489 B 0 B
build/block-library/blocks/table/style-rtl.css 386 B 0 B
build/block-library/blocks/table/style.css 386 B 0 B
build/block-library/blocks/tag-cloud/editor-rtl.css 118 B 0 B
build/block-library/blocks/tag-cloud/editor.css 118 B 0 B
build/block-library/blocks/tag-cloud/style-rtl.css 94 B 0 B
build/block-library/blocks/tag-cloud/style.css 94 B 0 B
build/block-library/blocks/template-part/editor-rtl.css 680 B 0 B
build/block-library/blocks/template-part/editor.css 679 B 0 B
build/block-library/blocks/text-columns/editor-rtl.css 95 B 0 B
build/block-library/blocks/text-columns/editor.css 95 B 0 B
build/block-library/blocks/text-columns/style-rtl.css 166 B 0 B
build/block-library/blocks/text-columns/style.css 166 B 0 B
build/block-library/blocks/verse/editor-rtl.css 62 B 0 B
build/block-library/blocks/verse/editor.css 62 B 0 B
build/block-library/blocks/verse/style-rtl.css 87 B 0 B
build/block-library/blocks/verse/style.css 87 B 0 B
build/block-library/blocks/video/editor-rtl.css 504 B 0 B
build/block-library/blocks/video/editor.css 503 B 0 B
build/block-library/blocks/video/style-rtl.css 193 B 0 B
build/block-library/blocks/video/style.css 193 B 0 B
build/block-library/common-rtl.css 1.01 kB 0 B
build/block-library/common.css 1.01 kB 0 B
build/block-library/editor-rtl.css 9.06 kB 0 B
build/block-library/editor.css 9.05 kB 0 B
build/block-library/index.js 144 kB 0 B
build/block-library/style-rtl.css 8.62 kB 0 B
build/block-library/style.css 8.61 kB 0 B
build/block-library/theme-rtl.css 748 B 0 B
build/block-library/theme.css 748 B 0 B
build/block-serialization-default-parser/index.js 1.88 kB 0 B
build/block-serialization-spec-parser/index.js 3.06 kB 0 B
build/blocks/index.js 48.3 kB 0 B
build/components/index.js 278 kB 0 B
build/components/style-rtl.css 15.5 kB 0 B
build/components/style.css 15.5 kB 0 B
build/compose/index.js 11.2 kB 0 B
build/core-data/index.js 16.8 kB 0 B
build/data-controls/index.js 828 B 0 B
build/data/index.js 8.81 kB 0 B
build/date/index.js 31.8 kB 0 B
build/deprecated/index.js 769 B 0 B
build/dom-ready/index.js 571 B 0 B
build/dom/index.js 4.93 kB 0 B
build/edit-navigation/index.js 11.1 kB 0 B
build/edit-navigation/style-rtl.css 938 B 0 B
build/edit-navigation/style.css 944 B 0 B
build/edit-post/index.js 307 kB 0 B
build/edit-post/style-rtl.css 6.79 kB 0 B
build/edit-post/style.css 6.78 kB 0 B
build/edit-site/index.js 24.1 kB 0 B
build/edit-site/style-rtl.css 4.04 kB 0 B
build/edit-site/style.css 4.04 kB 0 B
build/edit-widgets/index.js 20.1 kB 0 B
build/edit-widgets/style-rtl.css 3.2 kB 0 B
build/edit-widgets/style.css 3.2 kB 0 B
build/editor/editor-styles-rtl.css 543 B 0 B
build/editor/editor-styles.css 545 B 0 B
build/editor/index.js 41.8 kB 0 B
build/editor/style-rtl.css 3.89 kB 0 B
build/editor/style.css 3.89 kB 0 B
build/element/index.js 4.61 kB 0 B
build/escape-html/index.js 735 B 0 B
build/format-library/index.js 6.77 kB 0 B
build/format-library/style-rtl.css 637 B 0 B
build/format-library/style.css 639 B 0 B
build/hooks/index.js 2.27 kB 0 B
build/html-entities/index.js 622 B 0 B
build/i18n/index.js 3.74 kB 0 B
build/is-shallow-equal/index.js 698 B 0 B
build/keyboard-shortcuts/index.js 2.54 kB 0 B
build/keycodes/index.js 1.93 kB 0 B
build/list-reusable-blocks/index.js 3.15 kB 0 B
build/list-reusable-blocks/style-rtl.css 629 B 0 B
build/list-reusable-blocks/style.css 628 B 0 B
build/media-utils/index.js 5.33 kB 0 B
build/notices/index.js 1.85 kB 0 B
build/nux/index.js 3.41 kB 0 B
build/nux/style-rtl.css 731 B 0 B
build/nux/style.css 727 B 0 B
build/plugins/index.js 2.54 kB 0 B
build/primitives/index.js 1.42 kB 0 B
build/priority-queue/index.js 790 B 0 B
build/redux-routine/index.js 2.84 kB 0 B
build/reusable-blocks/index.js 2.92 kB 0 B
build/rich-text/index.js 13.4 kB 0 B
build/server-side-render/index.js 2.77 kB 0 B
build/shortcode/index.js 1.7 kB 0 B
build/token-list/index.js 1.27 kB 0 B
build/url/index.js 3.01 kB 0 B
build/viewport/index.js 1.86 kB 0 B
build/warning/index.js 1.14 kB 0 B
build/wordcount/index.js 1.22 kB 0 B

compressed-size-action

@etoledom
Copy link
Contributor Author

etoledom commented Dec 3, 2020

cc @iamthomasbishop @hypest

To be clear, this has no functionality. The only "important" piece of functionality missing is the calculation of the audio file's time length, but we can obtain it from the getMedia request to the WordPress backend:

            {
                "ID": 3865,
                "//": "...",
                "file": "christmas-time-6.mp3",
                "mime_type": "audio/mpeg",
                "extension": "mp3",
                "length": 238, <---
                "exif": {
                    "//": "...",
                    "length": 238, <---
                    "length_formatted": "3:58", <---
                },
                "//": "...",
            }

But this won't be available for files added via external URL.

If this is really necessary, I would implement this after this approach is accepted.

@iamthomasbishop
Copy link

Nice work @etoledom! I think this should work pretty nicely visually! My one concern is that there could be edge cases where this type of placeholder/façade UI will be confusing — such as when there's an error. I suppose this is pretty similar to how the Video block works so I don't expect any major issues, but let's make sure consider the various stress cases. For example:

  • Error while uploading
  • Progress/uploading
  • Audio file is unavailable/unreachable (offline?)

For all of these examples, I think we can probably simply replace the "play" button depending on state:

  • Error while uploading: use "error" icon
  • Progress/uploading: use circular indicator @jd-alexander is working on or use RN ActivityIndicator
  • Unavailable/unreachable: use "error" icon

@hypest
Copy link
Contributor

hypest commented Dec 4, 2020

this type of placeholder/façade UI will be confusing — such as when there's an error.

If I may add, even if not an error has occurred, I think it might be confusing anyway since the buttons won't be actionable at all. For example, even if they look disabled, it's not clear why they are disabled or how can someone enable them.

I suppose this is pretty similar to how the Video block works so I don't expect any major issues

I agree that the video block is semi-fake as well, but user can indeed tap the "Play" button and playback will commence in a browser screen. On the Audio block, tapping the Play will do nothing at all, right?

@etoledom etoledom force-pushed the rnmobile/audio-block-I-b branch from 6acd4ef to 276b07d Compare December 7, 2020 12:26
@etoledom etoledom force-pushed the rnmobile/audio-block-II-audio-player-ui branch from 1e4d554 to 8ad70a2 Compare December 7, 2020 12:33
@ceyhun ceyhun assigned ceyhun and unassigned etoledom Dec 9, 2020
@ceyhun
Copy link
Member

ceyhun commented Dec 9, 2020

Hey there 👋 I'll be continuing the work here.

On the Audio block, tapping the Play will do nothing at all, right?

That's right and it's the same behavior on web. But do we want the mobile audio block to play audio in the editor the end? That could introduce some other complexities and challenges as mentioned in the PR description. @iamthomasbishop WDYT? Should we maybe make the current "fake" disabled UI look more like it cannot be interacted instead?

@jd-alexander
Copy link
Contributor

Thanks for these thoughts @ceyhun

That's right and it's the same behavior on web. But do we want the mobile audio block to play audio in the editor the end?

I honestly think this could become a possibility in the future.
My thinking is that if we ever need to implement this, if say the web is doing it, we will have to find a way to address those issues. That seems like a mini-project on its own especially if we went the route of building our own audio player.

WDYT? Should we maybe make the current "fake" disabled UI look more like it cannot be interacted instead?

Yes, it will need to look disabled so the user doesn't try to interact with it. Honestly, now when I think about it, I would prefer if the Audio block looked more like the File block ( with a few minor alterations like adding an Audio Icon or something to it). The reason, I am thinking this is we are attempting to create a disabled UI similar to the web but as @iamthomasbishop stated there are several cases where the player UI could become confusing. So going down the File block path would allow us to avoid these cases as we already solved for them already. Of course, this would deviate away from the experience of the web a bit but I think that's an okay compromise for now since the functionality being offered by both blocks on their respective platforms would be the same. The work done already could be utilized in a project that would require the Audio block to have playback functionality. Let me know what you think peeps.

@etoledom
Copy link
Contributor Author

etoledom commented Dec 9, 2020

So going down the File block path would allow us to avoid these cases as we already solved for them already.

As I see it, the final goal of this it is to deliver the WISIWIG experience. It's not as much as it look similar to the Web editor, but closer to the final published post. This concept is mainly visual, so it's fine if the editor won't play audios on the editor.

WDYT? Should we maybe make the current "fake" disabled UI look more like it cannot be interacted instead?

I agree that this would be good to avoid some confusion 👍

(Just wanted to share my thoughts of why I started this PR and why I thought it could be a good approach 😃 )

@jd-alexander
Copy link
Contributor

So going down the File block path would allow us to avoid these cases as we already solved for them already.

As I see it, the final goal of this it is to deliver the WISIWIG experience. It's not as much as it look similar to the Web editor, but closer to the final published post. This concept is mainly visual, so it's fine if the editor won't play audios on the editor.

Ohh I never thought of it from this point of view. Thanks for this.

WDYT? Should we maybe make the current "fake" disabled UI look more like it cannot be interacted instead?

I agree that this would be good to avoid some confusion 👍

I agree with this as well.

(Just wanted to share my thoughts of why I started this PR and why I thought it could be a good approach 😃 )

Appreciated @etoledom 😄

@ceyhun
Copy link
Member

ceyhun commented Dec 10, 2020

Thanks everyone! Then I guess it makes sense to continue with the current approach for now.

Should we maybe make the current "fake" disabled UI look more like it cannot be interacted instead?

@iamthomasbishop any ideas about how to achieve this?

For all of these examples, I think we can probably simply replace the "play" button depending on state:

Error while uploading: use "error" icon
Progress/uploading: use circular indicator @jd-alexander is working on or use RN ActivityIndicator
Unavailable/unreachable: use "error" icon

@iamthomasbishop also again I couldn't really picture this because compared to the Video block we have in the Audio block also the slider, time indicators and volume controls. Could you maybe share some visuals?

@jd-alexander
Copy link
Contributor

jd-alexander commented Dec 10, 2020

@iamthomasbishop I wanted to provide some more context about some of the suggestions you made:

Progress/uploading: use circular indicator @jd-alexander is working on or use RN ActivityIndicator

We won't be shipping that circular indicator this time around as there are some upload flow improvements that need to be made and optimizing a new control for the current functionality won't be beneficial for us long term. More context about this in Eduardo's comment here

So with that said, would we be able to utilize the current upload progress UI/UX as one of the states and pair it with the state definitions you created that are based on replacing the play button in the disabled state of the control?

A compromise I just thought of is to utilize the RN ActivityIndicator as you mentioned to replace the play button and then the actual progress of the upload would be similar to the File/Image block etc. Let me know what your thoughts are on this. I think this combination would work and would create a consistent experience of the play button being replaced for all state changes. Let me know your thoughts.

@iamthomasbishop
Copy link

@ceyhun 👋 Until we're ready to implement a true inline player UI, I think it might be prudent to design something explicitly "placeholder-ish", rather than try to replicate the native player. I spent a few minutes sketching out an approach that I think could work, which borrows elements both from the placeholder/starter state of various media blocks and also the general layout of our Cell component. Here's a quick sketch of what I'm imagining for the component itself (which could be re-used for other scenarios where we want to show a "compact" representation:

And based on that, here are a bunch of variations, using either icon or text button as the right accessory:

I'm leaning towards a text label (middle column) because the primary action is very clear. In terms of the copy for that label, my suggestion would be either "Listen", "Open", or "View" — "Preview" might be confused with post/page preview, although a pre-pended/appended "play" icon on the text label might be enough of an affordance to avoid that issue.

Here are some quick higher-fidelity mocks to get a feel (note: colors, sizing, etc. not final):

I'd love to hear y'all's thoughts and/or suggestions! // cc @ceyhun @etoledom @jd-alexander and @kyleaparker

@jd-alexander
Copy link
Contributor

Thanks for these high fidelity mockups @iamthomasbishop I am in agreement with the placeholder UI being represented like this until we have an actual player. I am in favor of the rounded designs on the right because it looks similar to the preview of the Audio block on Chrome. I also like the text label as the primary action so we can be clear on what the user will be able to perform.

Would we still utilize the approach of changing the main icon based on the state?

@ceyhun
Copy link
Member

ceyhun commented Dec 11, 2020

I am in favor of the rounded designs on the right because it looks similar to the preview of the Audio block on Chrome. I also like the text label as the primary action so we can be clear on what the user will be able to perform.

I agree with both of these.

Would we still utilize the approach of changing the main icon based on the state?

Video Block

Uploading Error Success

File Block

Uploading Error Success

Looking at the Video block, I see that it's closer to its success state and the option to retry is more visible. Audio block could be similar to File block's error state if we only change the icon. In the error state you can still press the File block again to get the retry options.

I think progress bar will come for free with Audio block as well so maybe we show the success UI for the uploading state with the progress bar at the top? I'm still not sure how to show the error icon and the message to indicate that it can be retried though.

Base automatically changed from rnmobile/audio-block-I-b to master January 26, 2021 06:41
@ceyhun ceyhun mentioned this pull request Jan 29, 2021
6 tasks
Copy link
Contributor

@jd-alexander jd-alexander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The behavior here was tested and the changes work as expected. LGTM 🚢

@jd-alexander jd-alexander merged commit aadc511 into master Feb 1, 2021
@jd-alexander jd-alexander deleted the rnmobile/audio-block-II-audio-player-ui branch February 1, 2021 15:36
@github-actions github-actions bot added this to the Gutenberg 10.0 milestone Feb 1, 2021
fluiddot pushed a commit that referenced this pull request Feb 2, 2021
* Basics of Audio block working

* Add audio support to MediaUpload

* Add handling of file uploads and replace

* WPMediaLibrary support for Audio block

* Avoid removing media info on error state

* Linting

* Added an AUDIO file to the test requestMediaPickFromMediaLibrary func

* Fixed typo in ToolbarButton of Audio Block.

* Removed auto help behavior present on web that's not used on mobile.

* [Android] Wired the click of the Audio Media Library button.

* Added Audio media options for choosing audio file locally.

* [RNMobile] Audio Block: Proper caption field (#27689)

* Audio Player UI for audio block

* Add extension to styles import

* Show file name while loading and retry message on error

* Pass state props to audio player component

* Implement placeholder-ish player UI structure

* added styles for icon, title and subtitle

* added blue-wordpress as link color.

* added sizing based on design specs.

* Fixed object destructuring error.

* added icon styling state for upload in progress or upload failed.

* implemented error style and behavior.

* added styling for upload failed text.

* Override MediaUploadProgress styles

* Update filename extension spseration to handle two dots

* Update UI structure and styles

* Make retry message translateable

* Update snaphots

* Fix lint error

* Set initial file name

* Remove devOnly flag from audio block

* Increase tap target of button

* Add 1px between title and subtitle

* Align title, subtitle and button vertically

* On iOS use VideoPlayer to play audio files in-app

* Revert "On iOS use VideoPlayer to play audio files in-app"

This reverts commit b1eb8dd.

* [RNMobile] Audio Block -  Cancel and Retry Dialog (#28540)

Co-authored-by: Ceyhun Ozugur <[email protected]>

* Rename button title

* Add pill-shaped background to button

* Add padding to title

* Fix file title being empty when selecting from media library

* Use safeDecodeURI

* On iOS use VideoPlayer to play audio files in-app

* Decrease button font size

Co-authored-by: Joel Dean <[email protected]>

* Revert "Remove devOnly flag from audio block"

This reverts commit e6b5b6d.

* Add right padding to title container to fix error state

Co-authored-by: Joel Dean <[email protected]>
Co-authored-by: Ceyhun Ozugur <[email protected]>
fluiddot added a commit that referenced this pull request Feb 5, 2021
* Release script: Update react-native-editor version to 1.46.0

* Release script: Update with changes from 'npm run core preios'

* [RNMobile] Correct condition in setting blockWidth (#28635)

* [RNMobile] Fix height of the bottom-sheet after using back button (#28632)

* remove unused param and setHeight even if it is the same

* [RNMobile] Audio Player UI for audio block (#27467)

* Basics of Audio block working

* Add audio support to MediaUpload

* Add handling of file uploads and replace

* WPMediaLibrary support for Audio block

* Avoid removing media info on error state

* Linting

* Added an AUDIO file to the test requestMediaPickFromMediaLibrary func

* Fixed typo in ToolbarButton of Audio Block.

* Removed auto help behavior present on web that's not used on mobile.

* [Android] Wired the click of the Audio Media Library button.

* Added Audio media options for choosing audio file locally.

* [RNMobile] Audio Block: Proper caption field (#27689)

* Audio Player UI for audio block

* Add extension to styles import

* Show file name while loading and retry message on error

* Pass state props to audio player component

* Implement placeholder-ish player UI structure

* added styles for icon, title and subtitle

* added blue-wordpress as link color.

* added sizing based on design specs.

* Fixed object destructuring error.

* added icon styling state for upload in progress or upload failed.

* implemented error style and behavior.

* added styling for upload failed text.

* Override MediaUploadProgress styles

* Update filename extension spseration to handle two dots

* Update UI structure and styles

* Make retry message translateable

* Update snaphots

* Fix lint error

* Set initial file name

* Remove devOnly flag from audio block

* Increase tap target of button

* Add 1px between title and subtitle

* Align title, subtitle and button vertically

* On iOS use VideoPlayer to play audio files in-app

* Revert "On iOS use VideoPlayer to play audio files in-app"

This reverts commit b1eb8dd.

* [RNMobile] Audio Block -  Cancel and Retry Dialog (#28540)

Co-authored-by: Ceyhun Ozugur <[email protected]>

* Rename button title

* Add pill-shaped background to button

* Add padding to title

* Fix file title being empty when selecting from media library

* Use safeDecodeURI

* On iOS use VideoPlayer to play audio files in-app

* Decrease button font size

Co-authored-by: Joel Dean <[email protected]>

* Revert "Remove devOnly flag from audio block"

This reverts commit e6b5b6d.

* Add right padding to title container to fix error state

Co-authored-by: Joel Dean <[email protected]>
Co-authored-by: Ceyhun Ozugur <[email protected]>

* [RNMobile] Enable Audio Block (#28594)

Co-authored-by: Joel Dean <[email protected]>

* Update react-native-editor CHANGELOG

* Update unsupported block test data for UI tests (#28649)

The unsupported block now used is jetpack/gif since Audio block is now supported.

* Revert indentation of modified package.json files

* Update react-native-editor CHANGELOG

* [RNMobile] Move custom indicator to be rendered above the colors (#28698)

* [RNMobile] Move back disabled style for button in File block (#28704)

Co-authored-by: Luke Walczak <[email protected]>
Co-authored-by: Drapich Piotr <[email protected]>
Co-authored-by: etoledom <[email protected]>
Co-authored-by: Joel Dean <[email protected]>
Co-authored-by: Ceyhun Ozugur <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants