question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Video doesn't work with new cameraRoll uri path with prefix "ph://" on iOS RN 0.59.5

See original GitHub issue

Current behavior

video playback doesn’t work with RN 0.59.5 with new cameraRoll URI format using prefix “ph://” on iOS

Reproduction steps

get videos from cameraRoll on iOS and use the URI path with prefix “ph://”

Expected behavior

Video should play

Platform

Which player are you experiencing the problem on: iOS

Details: With RN 0.58.6 cameraRoll returned videos in this format for example:

{ node: 
   { timestamp: 1515357324,
     location: 
      { altitude: 0,
        heading: -1,
        speed: -1 },
     group_name: 'Camera Roll',
     type: 'ALAssetTypeVideo',
     image: 
      { width: 720,
        height: 1280,
        isStored: true,
        filename: 'IMG_0013.mp4',
        uri: 'assets-library://asset/asset.mp4?id=D34D1148-2CC7-4AE9-BB2E-67ACBCB60A10&ext=mp4',
        playableDuration: 10 } } }

Passing the ‘asset-library’ URI to react-native-video v4.4.0 worked.

However in React Native v0.59.x the cameraRoll API returns videos in the format:

 node: 
   { timestamp: 1554232151,
     type: 'video',
     group_name: 'Camera Roll',
     location: {},
     image: 
      { width: 1080,
        uri: 'ph://D916EEFD-317B-403D-B589-B3ED9B17E784/L0/001',
        height: 1920,
        isStored: true,
        playableDuration: 4.365 } } }

react-native-video does not work with the new URI format.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:7
  • Comments:17 (1 by maintainers)

github_iconTop GitHub Comments

40reactions
talal7860commented, May 4, 2019

This is what I did to get it working

  const appleId = image.uri.substring(5, 41);
  const uri = `assets-library://asset/asset.${ext}?id=${appleId}&ext=${ext}`;`

This should get it working until react-native-video adds a fix

6reactions
cnicklesscommented, May 4, 2020

Converting assets from PH:// to assets-library:// seems to work if the file is local, but in instances where you fetch ‘All’ from CameraRoll you can at times find a video that is stored on iCloud. Trying to load these videos will not load (onLoad) and does not throw an error (onError).

I’m setting up a timeout to notify users if the file does not load right away (not local file) but has anyone uncovered a way to load iCloud assets into react-native-video?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Video doesn't work with new cameraRoll uri path with prefix ...
Current behavior video playback doesn't work with RN 0.59.5 with new cameraRoll URI format using prefix "ph://" on iOS Reproduction steps ...
Read more >
react native - Camera Roll returned uri does not have file's ...
I have a work around, the returned extension is not pretty but it is useable: From the file RNCCameraRollManager.m: Please add these 2...
Read more >
Camera-roll | npm.io
Simple expo camera example with camera functionality separated from overlay styles. expocamerareact-nativecamera-rollflipsavecancelvideorecordingzoom. 2.0.0 • ...
Read more >
@react-native-camera-roll/camera-roll - npm
On iOS, the tag can be any image URI (including local, remote asset-library and base64 data URIs) or a local video file URI...
Read more >
react-native-video video doesn't work with new cameraRoll uri path ...
video playback doesn't work with RN 0.59.5 with new cameraRoll URI format ... get videos from cameraRoll on iOS and use the URI...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found