AVPlayer reports duration of 1 second for HLS assets when AirPlay is active
| Originator: | wilson.jim.r | ||
| Number: | rdar://12685063 | Date Originated: | 12-Nov-2012 06:06 PM |
| Status: | Open | Resolved: | |
| Product: | Apple TV | Product Version: | 5.1 |
| Classification: | Other Bug | Reproducible: | Always |
Summary: When an AVPlayer is instantiated and visible in the application and AirPlay mode is already active (routed to an Apple TV device) an HLS asset will report a duration of exactly 1 second, no matter how long the actual video is. Steps to Reproduce: * Create the App: * Create a Single View application in XCode * In the ViewController, instantiate an AVPlayer * Use an AVPlayerLayer to attach the AVPlayer to the ViewController's view, * Use an MPVolumeView to expose the AirPlay button, * Instantiate an AVPlayerItem which points to an HLS asset, * Use KVO to watch the item's duration property for changes, log duration values received to the console, * Use the AVPlayer's replaceCurrentItemWithPlayerItem: method to set the AVPlayerItem, * Run the app: * Run the app on an iPad or iPhone running iOS 5.0 or higher * In the running app, use the MPVolumeView AirPlay button to pair with an Apple TV running iOS 5.1 * With the AVPlayer still streaming to the Apple TV, kill the app and relaunch (this is to ensure that the player is tethered to the external device during initialization) * The app should now be running, paired with the AppleTV Expected Results: * As better duration information becomes available, the duration reported by KVO should match the actual underlying asset. Actual Results: * Irrespective of the actual length of the HLS movie, the duration is reported as 1 second Regression: * We did not see this behavior on Apple TV devices running iOS 5.0.2 Notes: * One workaround we've found is to set allowsExternalPlayback (allowsAirPlayVideo) to NO until a non-1 duration has been reported by the AVPlayerItem.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!