AVPlayerItem.presentationSize modified on end of HLS playback
| Originator: | jpswensen | ||
| Number: | rdar://17668183 | Date Originated: | 14-Jul-2014 |
| Status: | Open | Resolved: | |
| Product: | iOS | Product Version: | 7.0, 7.1 |
| Classification: | Serious Bug | Reproducible: | Always |
Summary: I was using AVPlayer to play MP4 and MOV files from a server. Then I changed to playing HLS files with multiple bitrate options. Now, when the video completes the still of the last frame that it leaves on the screen is very distorted. I am using the AspectFill gravity and the playback works great. As I was trying to figure out what was going wrong, I decided to start looking at the presentationSize of the AVPlayerItem by executing NSLog(@"Presentation size: (%f,%f)", self.player.currentItem.presentationSize.width, self.player.currentItem.presentationSize.width); in the loadedTimeRanges KVO while the video is buffering and in a notification called for "AVPlayerItemDidPlayToEndTimeNotification". During buffering and playback the presentation size is the expected size of 320x320, however the distortion occurs before the AVPlayerItemDidPlayToEndTimeNotification is triggered and inside the notification the presentationSize is 1280x1280. I am not modifying the presentationSize anywhere other than by setting the frame when my AVPlayerView is created. Steps to Reproduce: The easiest way to reproduce is to download the AVPlayerDemo provided by Apple from https://developer.apple.com/library/ios/samplecode/AVPlayerDemo/Introduction/Intro.html. Then, near line 139 of AVPlayerDemoAppDelegate.m, change: NSURL* URL = [defaults URLForKey:AVPlayerDemoContentURLUserDefaultsKey]; to: NSURL *URL = [NSURL URLWithString:@"http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8"]; This will cause the bipbop HLS demo video to load in the player. Then scrub all the way until you are near the end and start playing. When the player reaches the end of playback, the presentationSize of the AVPlayerItem changes and the final frame of the video is distorted. Expected Results: I would expect the video to end on the last frame with the exact same visual image as the last frame Actual Results: The video ends and the contents are distorted to a much larger size. Additional information: Just to give a little more information on something I tried, but didn't work.I tried adding a KVO observer for the presentationSize field of the AVPlayerItem. Then when it actually changed, I tried to set the frame size of the AVPlayerLayer associated with the AVPlayer and AVPlayerItem. The AVPlayerItem documentation (see https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVPlayerItem_Class/Reference/Reference.html#//apple_ref/occ/instp/AVPlayerItem/presentationSize) says "You can also scale the presentation size arbitrarily using the frame property of an AVPlayerLayer object." However, after setting the frame of the AVPlayerLayer, the presentationSize of the AVPlayerItem remains unchanged.
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!
Fixed in iOS8.2 and above