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

Request: update docs about when player.videoFormat.width could return NO_VALUE #5409

Closed
AndroidDeveloperLB opened this issue Jan 20, 2019 · 5 comments
Assignees
Labels

Comments

@AndroidDeveloperLB
Copy link

AndroidDeveloperLB commented Jan 20, 2019

It only says there about NO_VALUE that :

value for various fields to indicate that the field's value is unknown or not applicable.

But it doesn't say when it occurs.
If I open an MP4 file from a server, could it occur ?

How could it be that it's about to show a video, but doesn't know what is the size of the video? I don't understand what are the possible scenarios for this...

Or is it just when the video wasn't decoded at all yet? But this might be what "not applicable" means, no? What about "unknown" ?

Please update the docs about it. Should we handle such weird cases even in VideoListener.onRenderedFirstFrame callback?

@ojw28 ojw28 self-assigned this Jan 21, 2019
@ojw28 ojw28 added the question label Jan 21, 2019
@ojw28
Copy link
Contributor

ojw28 commented Jan 21, 2019

If you need to size something (e.g. a UI component) then you should use VideoListener.onVideoSizeChanged, which isn't documented as receiving NO_VALUE. This is what PlayerView does, for example. This callback gets the size on the output size of the decoder, which is the actual size of the decoded video buffers.

Or is it just when the video wasn't decoded at all yet? But this might be what "not applicable" means, no? What about "unknown" ?

  • Not applicable would normally mean it's not a video Format (e.g. resolution is not applicable to audio formats).
  • Unknown means it is a video Format, but the dimensions are unknown. It's somewhat hard to document the cases because Format objects are used throughout the codebase. As an example, a Format derived from an HLS manifest that doesn't use resolution tags would end up falling into this category. An attempt to document all such occurrences centrally in Format Javadoc would inevitably code rot. An attempt to document them in a distributed way wouldn't really work, because no-one would find it. The extent to which pieces of the player can be customized also poses a further challenge.

In practice I think SimpleExoPlayer.getVideoFormat will always return a Format with set resolution by the time onRenderedFirstFrame is set, but as above, you should use VideoListener.onVideoSizeChanged to be sure.

@AndroidDeveloperLB
Copy link
Author

AndroidDeveloperLB commented Jan 22, 2019

About VideoListener.onVideoSizeChanged and onRenderedFirstFrame , ok, but I'm still curious:

How could a video have an unknown resolution? Does it have a changing resolution as you play it?

Is it possible to get just the video specs without really playing it? Or is the normal, Android framework API good enough for this, as shown here for example? Which is more recommended? Does ExoPlayer support more ? Is it more reliable? I can see that this API is for files, but I wonder if it's also for other types ...

Anyway, I suggest to mention the onVideoSizeChanged in the docs for this, as a suggestion of where to get this information, when it's safe.

@ojw28
Copy link
Contributor

ojw28 commented Jan 23, 2019

The video resolution is always known when the output buffers come out of the decoder. As above, use VideoListener.onVideoSizeChanged to get it.

Is it possible to get just the video specs without really playing it? Or is the normal, Android framework API good enough for this, as shown here for example? Which is more recommended? Does ExoPlayer support more ? Is it more reliable? I can see that this API is for files, but I wonder if it's also for other types ...

ExoPlayer doesn't currently support this use case (although with enough ingenuity it would be possible to implement with the various components that ExoPlayer provides). Providing direct support is tracked by #3609.

@AndroidDeveloperLB
Copy link
Author

AndroidDeveloperLB commented Jan 24, 2019

I see.
The link you provided seems like the exact question I asked, right? Though, it is said about audio and not video... So I've asked about it there too :)

@ojw28 ojw28 closed this as completed Mar 6, 2019
@AndroidDeveloperLB
Copy link
Author

@ojw28 Were the docs updated, then? Is it now clearer?

@google google locked and limited conversation to collaborators Aug 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants