[osg-users] [osgPlugins] iOS/OSX: avfoundation plugin not reporting correct media duration
Alessandro Terenzi
a.terenzi at gmail.com
Fri Jan 19 02:02:10 PST 2018
Hi Robert,
as far as I know the issue was present already with OSG version 3.4.0.
According to the AVFoundation documentation it seems that when one wants to access 'static' aspects of a media, such as the duration it is safe to rely on the AVAsset reference while when actually playing the media one has to use the AVPlayerItem instance, whose specific duration may be available only after a while... this is the reason, I think, the _duration variable is set to 0 in the above code.
This is what the doc says:
> AVAsset only models the static aspects of the media, such as its duration or creation date, and on its own, is unsuitable for playback with an AVPlayer. To play an asset, you need to create an instance of its dynamic counterpart found in AVPlayerItem.
In my proposal, [avplayer.currentItem asset] is the AVAsset reference that stores the static duration of the movie, and avplayer.currentItem is the AVPlayerItem that is still used for playback.
Anyway, I'm not an expert of AVFoundation, so please, anyone with more experience with that is welcome to comment :)
Cheers,
Alessandro
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=72789#72789
More information about the osg-users
mailing list