souvik-ghosh / react-native-create-thumbnail

iOS/Android thumbnail generator with support for both local and remote videos
MIT License
251 stars 105 forks source link

[iOS] Error: Error Domain=AVFoundationErrorDomain Code=-11832 "Cannot Open" UserInfo={NSLocalizedFailureReason=This media cannot be used., NSLocalizedDescription=Cannot Open, NSUnderlyingError=0x600000ddeaf0 {Error Domain=NSOSStatusErrorDomain Code=-12431 "(null)"}} #117

Open tacianoscur opened 2 months ago

tacianoscur commented 2 months ago

Describe the bug Getting this error when creating thumbnail for remote MP4 video on iOS, only happens for some videos:

[Error: Error Domain=AVFoundationErrorDomain Code=-11832 "Cannot Open" UserInfo={NSLocalizedFailureReason=This media cannot be used., NSLocalizedDescription=Cannot Open, NSUnderlyingError=0x600000ddeaf0 {Error Domain=NSOSStatusErrorDomain Code=-12431 "(null)"}}]

To Reproduce Steps to reproduce the behavior:

  1. Call createThumbnail with a remote url for an mp4 video (I can send you the url if needed)

Version react native 0.72.11 react-native-create-thumbnail ^2.0.0

Expected Results Should create the thumbnail like with all the other videos.

Snack, code example, screenshot, or link to a repository

import { createThumbnail } from 'react-native-create-thumbnail';
const createdThumbnail = await createThumbnail({
      url: video.url,
});
LianVyv commented 2 months ago

@tacianoscur I believe you missing a timestamp

const createdThumbnail = await createThumbnail({
      url: video.url,
      timeStamp: 0, // capture the thumbnail at the beginning of the video
});
oneeb-asad commented 2 months ago

I'm also facing this issue have you find any solution for this?

P.S: adding timestamp didn't resolved my problem

tacianoscur commented 2 months ago

@LianVyv I have added many timestamps but same error every time.

Satyajeetsinh-9 commented 1 month ago

Hello , i am facing same issue on IOS with mp4 file plus adding timestamp also did not resolve this.

So anyone with any solution?

tacianoscur commented 1 month ago

@souvik-ghosh any idea when you pretend to tackle this?

Satyajeetsinh-9 commented 1 month ago

FYI : in my case I'm not receiving Accept-Ranges in a header from the server, which is generally required for IOS. Because when tried with a different server in API It started working.

ngunarola commented 1 week ago

const createVideoThumbnail = () => { createThumbnail({ url: '', timeStamp:100, format:'png' }) .then(response => console.log({ response })) .catch(err => console.log({ err })); }

I have tried timeStamp:100. It worked for me !!