Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow GetMediaInformation Function to fail with response #20

Closed
JChappel opened this issue Apr 15, 2021 · 6 comments
Closed

Allow GetMediaInformation Function to fail with response #20

JChappel opened this issue Apr 15, 2021 · 6 comments
Assignees
Labels
apple Affect Apple platforms library Affects the library no-issue-activity question Further information is requested v4.4 Affects v4.4 release

Comments

@JChappel
Copy link

Is your feature request related to a problem? Please describe.
When using FFprobeKit.getMediaInformation(url) it seems to only work if the url is valid. Which prevents subsequent code from being executed, by getting stuck.

Describe the solution you'd like
It would be useful if it provided a ReturnCode as the FFmpegKit provides. This way you know if the media information request failed and if so why. Or at a minimum, it could return nil if it fails.

Describe alternatives you've considered
I have added my own check before I execute GetMediaInformation. I check to see if I can hit the URL and get a response before trying the GetMediaInformation.

Platform
I'm currently experiencing the issue in Swift on tvOS but I would guess it would be a cross-platform issue.

Additional context

@tanersener
Copy link
Collaborator

tanersener commented Apr 15, 2021

getMediaInformation returns a MediaInformationSession. You should be able to see why it fails by checking.

  1. State -> [session getState]
  2. Return code -> [session getReturnCode]
  3. Fail String -> [session getFailStackTrace]
  4. Output -> [session getOutput]

There is also a getMediaInformationAsync method on FFprobeKit. It is an asynchronous method. So, it won't block your main thread. You can try using it if you want to unblock other threads.

@tanersener tanersener added the question Further information is requested label Apr 15, 2021
@tanersener tanersener self-assigned this Apr 15, 2021
@JChappel
Copy link
Author

So what I was seeing is it was never getting past the getInformation command in Swift. Unless the URL was valid and then it would go on as normal and I could use MediaInformationSession.

@tanersener
Copy link
Collaborator

Well, there is not much we can do about it. When the URL is not valid ffmpeg waits HTTP/HTTPS stack to return an error. Depending the protocol and URI part that is not valid, this may take time.

My suggestion is to use the asynchronous getMediaInformationAsync method to unblock your application threads.

@JChappel
Copy link
Author

Ok thanks, I just saw there is also GetMediaInformation withTimeout. Will setting a timeout say of 1 second cause it to fail if the URL does not respond?

@tanersener
Copy link
Collaborator

No, it won't. That timeout is for something else. You're free to try but it shouldn't change anything.

@tanersener tanersener added the apple Affect Apple platforms label Apr 16, 2021
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apple Affect Apple platforms library Affects the library no-issue-activity question Further information is requested v4.4 Affects v4.4 release
Projects
None yet
Development

No branches or pull requests

2 participants