wordpress-mobile/gutenberg-mobile

Video block: Videos can't be played in private sites

Closed this issue · 1 comments

Describe the bug
Videos uploaded to private sites or videos marked as private can't be played in the editor via the Video block.

To Reproduce

  1. Go to a Simple site in WPCOM.
  2. Go to the Site Settings screen.
  3. Change Privacy to Private.
  4. Open a post/page.
  5. Add a Video block.
  6. Upload a video from the local device or record one.
  7. Once the upload finishes, tap on the video to play it.
  8. Observe that the video doesn't load and can't be played.

Expected behavior
Private videos should be playable within the Video block.

Screenshots

RPReplay_Final1677088758.MP4

Smartphone (please complete the following information):

  • Device: iPhone 11
  • OS: 15.4.1
  • Version: Jetpack 21.7.0.0

Additional context
This issue is caused because videos uploaded to Simple and Atomic sites are also added to VideoPress. On iOS, when fetching the video item, we use the VideoPress URL provided by the videos endpoint and the original response parameter. However, for playing private videos, we also need to pass a query parameter metadata_token with the token of that video. Otherwise, the request fails with error 403 Forbidden.