Conversation
# Conflicts: # Podfile # Podfile.lock # WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController.swift
# Conflicts: # Podfile.lock
6594f42 to
97b51f5
Compare
# Conflicts: # Podfile.lock
# Conflicts: # Podfile.lock
|
We can experiment on running tests in the test plan I prepared for video block https://wordpress-mobile.testquality.com/project/6587/plan/11476/run/91298 |
|
cc @koke |
# Conflicts: # Podfile # Podfile.lock
SergioEstevao
left a comment
There was a problem hiding this comment.
I tested the iOS app, and things are working great. I tested the following:
- Add a video from device
- Add a video from media library
- Cancel a video upload by tapping the image
- Cancel a video upload by deleting the block
- Retested the image functionality.
| break | ||
| } | ||
| gutenberg.mediaUploadUpdate(id: mediaUploadID, state: .succeeded, progress: 1, url: url, serverID: mediaServerID) | ||
| if media.mediaType == .image { |
There was a problem hiding this comment.
Maybe a switch will be better, just in case in the future we add some extra cases.
| } | ||
| } | ||
|
|
||
| func fetchVideoPressUrl(for media: Media, completion: @escaping ( Result<(videoURL: URL, posterURL: URL?)> ) -> Void) { |
There was a problem hiding this comment.
I think the name should be fetchVideoPressURL
There was a problem hiding this comment.
that method's implementation has changed so I updated its name as fetchRemoteURL
| if media.mediaType == .image { | ||
| gutenberg.mediaUploadUpdate(id: mediaUploadID, state: .succeeded, progress: 1, url: url, serverID: mediaServerID) | ||
| } else if media.mediaType == .video { | ||
| fetchVideoPressUrl(for: media) { [weak self] (result) in |
There was a problem hiding this comment.
VideoPress information will only be available if the site is WordPress.com or using Jetpack.
If it's a self-hosted site without Jetpack the video will not be videoPress and you will need to send the 'media.remoteURL' directly.
There was a problem hiding this comment.
great catch! I have updated the code accordingly
|
|
||
| func fetchVideoPressUrl(for media: Media, completion: @escaping ( Result<(videoURL: URL, posterURL: URL?)> ) -> Void) { | ||
| guard let videoPressID = media.videopressGUID else { | ||
| completion(Result.error(NSError())) |
There was a problem hiding this comment.
If there is no videoPressID the site can be a self-hosted site without VideoPress so you should return directly the media.remoteURL
There was a problem hiding this comment.
Great insights @SergioEstevao ! Luckily I have a self-hosted site which I only use for testing, I had the chance to test on that and yes media.remoteURL works like a charm
There was a problem hiding this comment.
cc @marecar3 don't forget to handle the case for self-hosted sites on WPAndroid also. I can give you login info to my self hosted site if you need for testing.
# Conflicts: # Podfile.lock
Hey @SergioEstevao 👋 Did you try to tap on an already uploaded video, when there is another video currently uploading?
|
@daniloercoli on iOS it's working ok, when you tap on already it opens a full screen preview of tha video. If you tap on a current uploading video you get a an action sheet asking to cancel upload or dismiss. |
# Conflicts: # Podfile # Podfile.lock
Otherwise local url remains if upload completes outside of gutenberg editor
|
hey @etoledom, @SergioEstevao 👋 I pushed a new commit to address this: About the crash on background thread I opened an issue for Groundskeeping: #11664 original comment too see more context: wordpress-mobile/gutenberg-mobile#854 (review) |
|
|
||
| extension AbstractPost { | ||
|
|
||
| func fetchRemoteVideoURL(for media: Media, completion: @escaping ( Result<(videoURL: URL, posterURL: URL?)> ) -> Void) { |
There was a problem hiding this comment.
I don't think this is the best place for this method because of:
- The method isn't related to the Post object in anyway, if we are doing an extension maybe it should be to the Media object.
- Even as an extension to the media object it will be a bit out of place because it's creating a MediaService inside and the entity objects should avoid creating service, it should be the other way around.
What about creating a helper class? What was the initial reason to move it here?
There was a problem hiding this comment.
Actually I don't have a strong reason, I was hesitant about putting it here too. Yes I can put that into a helper
|
Fwiw, this fixes the issue on my tests 🎉 |
|
@SergioEstevao Could you please re-review? (I moved the method to EditorMadiaUtility) |
|
@pinarol - I've found a new issue uploading multiple videos. This wasn't happening before so it seems to be a regression from the last update: Intent: Upload many different videos.
I believe that this happens even if some videos already finished uploading. |
# Conflicts: # Podfile.lock
|
hey @marecar3 could you be able to check if this is happening on Android ? #11454 (comment) if so at least we'd know where to look for. |
| } | ||
| switch media.mediaType { | ||
| case .video: | ||
| EditorMediaUtility.fetchRemoteVideoURL(for: media, in: post) { [weak self] (result) in |
There was a problem hiding this comment.
@SergioEstevao I have second thoughts about where to put this service call because this is being called for classical editor posts also. is there any chance you know a better place to put this?
| case .error: | ||
| self?.change(post: post, status: .failed) | ||
| case .success(let value): | ||
| media.remoteURL = value.videoURL.absoluteString |
There was a problem hiding this comment.
also I am not sure if that's a right thing to change a managed object like this :(
Hey, @etoledom @pinarol I have tested this scenario on WPAndroid, and is seems that everything is working fine. I have tested with 2 videos and when the upload was finished in the Post list, I opened the Post and both videos were different. |
…correct media finished.
WordPress/Classes/ViewRelated/Gutenberg/Processors/GutenbergVideoUploadProcessor.swift
Outdated
Show resolved
Hide resolved
WordPress/Classes/ViewRelated/Gutenberg/Processors/GutenbergVideoUploadProcessor.swift
Outdated
Show resolved
Hide resolved
@etoledom I pushed some changes to the PR that address this issue, do you mind to retest it? |
|
Hey @SergioEstevao nice work here! I have tested this and it's working good :) |

Fixes wordpress-mobile/gutenberg-mobile#855
There are also some more TODO items in this issue: wordpress-mobile/gutenberg-mobile#687 (comment) which are not handled in this PR
gutenberg-mobile PR: wordpress-mobile/gutenberg-mobile#854
To test:
Prerequisites:
Run metro on gutenberg-mobile PR branch
Run
rake dependenciesTest 1
First of all try all the media upload test cases described here:wordpress-mobile/gutenberg-mobile#854 (Except, in order to fail the upload try turning off the internet and waiting a bit)
Test 2
Try uploading by video capture by selecting

Take a Videoin a real device:Test 3 Media filters
Media is filtered due to the block type with this PR

So you should be able to pick/capture only videos for video block, and only images for image block
Check both blocks and verify that this is true for all the options here:
Test 4 Add caption
Add a video caption text and save the post
Reopen the same post and verify the caption is added
Test 5 Simultaneous uploads
Try adding multiple video and image blocks
And try simultaneous uploads
Verify that there's no confusion and every upload is completed successfully to their intended block
Test 6 Switch to Classic editor
Add a video block and add video in it
Switch to Classic editor
Verify that video is there and it is playable
Update release notes:
RELEASE-NOTES.txt.We aren't shipping the video block to production yet