avplayer

Customizing subtitles with AVPlayer

早过忘川 提交于 2019-12-20 23:31:52
问题 I was able to display a subtitle track with AVPlayer on iOS 6, but I am not able to customize it. It just shows the same style (a small font size, in white). Here's how I select the subtitle: AVMediaSelectionGroup *subtitle = [asset mediaSelectionGroupForMediaCharacteristic: AVMediaCharacteristicLegible]; [self.videoPlayer.currentItem selectMediaOption:subtitle.options[0] inMediaSelectionGroup: subtitle]; And how I'm trying to customize the subtitle: AVTextStyleRule *rule = [[AVTextStyleRule

AVFoundation audio processing using AVPlayer's MTAudioProcessingTap with remote URLs

被刻印的时光 ゝ 提交于 2019-12-20 14:18:06
问题 There is precious little documentation on AVAudioMix and MTAudioProcessingTap, which allow processing to be applied to the audio tracks (PCM access) of media assets in AVFoundation (on iOS). This article and a brief mention in a WWDC 2012 session is all I have found. I have got the setup described here working for local media files but it doesn't seem to work with remote files (namely HLS streaming URLs). The only indication that this is expected is the note at the end of this Technical Q&A:

An AVPlayerItem cannot be associated with more than one instance of AVPlayer'

▼魔方 西西 提交于 2019-12-20 11:35:55
问题 -(IBAction)play:(id)sender { thumbImageView.alpha=0.0; NSString *stringvideo=[NSString stringWithFormat:@"http://streaming-service",[[NSUserDefaults standardUserDefaults]valueForKey:@"VideoIdselected"]]; NSString *videoURLString = stringvideo; NSURL *url = nil; url = [NSURL URLWithString:videoURLString]; self.moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:url]; if (self.moviePlayerController) { /* Save the movie object. */ [self setMoviePlayerController:self

Is it possible to pause and resume buffering of AVPlayer?

荒凉一梦 提交于 2019-12-20 10:58:04
问题 Is it possible to pause and resume buffering of AVPlayer? 回答1: Yes it is possible to some extent! You can use the playerItem's preferredForwardBufferDuration property to decide how much duration from the current playing time the player should prefetch. But sadly, this is only available from iOS version 10. Macro to check system version: #define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending) You

How to find AVPlayer current bitrate

自闭症网瘾萝莉.ら 提交于 2019-12-20 10:57:17
问题 I am trying to fetch bit rate at which the AVPlayer is playing the video stream . I tried with observed bit rate property of AVPlayerItemAccessLogEvent , but it gives very high value.After exploring further on Observed-bit-rate property I understood that this property shows the value of download rate of a segment .I need to know the bit rate at which the player is playing the stream. The graph below shows Observed bit vs Indicated bit rate for the LIVE stream. Kindly give your suggestion on

Resume AVPlayer video playback after app become active

浪尽此生 提交于 2019-12-20 10:27:06
问题 I write custom player from AVPlayer for video playback. According to Apple docs set the video layer: self.player = [IPLPlayer new]; self.player.playerLayer = (AVPlayerLayer *)self.playerView.layer; Where self.playerView is usual class from those docs: @implementation PlayerView + (Class) layerClass { return [AVPlayerLayer class]; } - (AVPlayer *)player { return [(AVPlayerLayer *)[self layer] player]; } - (void)setPlayer:(AVPlayer *) player { [(AVPlayerLayer *) [self layer] setPlayer:player];

AVPlayer continues to play after ViewController is removed from NavigationController

偶尔善良 提交于 2019-12-20 10:04:28
问题 So I'm using ARC in my project and when I add an AVPlayerLayer it works just fine and dandy, but when I pop the UIViewController from my UINavigationItem the video continues to play in the background. Does anyone know how you would handle this? It seems like something easy I'm just overlooking. Here's the code I have for the initially instantiations. self.currentItem = [[AVPlayerItem alloc] initWithURL:url]; self.player = [[AVPlayer alloc]initWithPlayerItem:self.currentItem]; self

Timed Metadata with AVPlayer

南楼画角 提交于 2019-12-20 09:25:09
问题 Can you control how AVURLAsset loads the data it requires? I need to add a custom HTTP header ( ICY-MetaData=1 ) and can't seem to figure out how. 回答1: Apparently, AVPlayer automatically requests metadata from Icecast. The code below works perfectly. class ViewController: UIViewController { var Player: AVPlayer! var PlayerItem: AVPlayerItem! override func viewDidLoad() { super.viewDidLoad() PlayerItem = AVPlayerItem(URL: NSURL(string: "http://live.machine.fm/aac")) PlayerItem.addObserver(self

MPNowPlayingInfoCenter not reacting properly when pausing playback

不问归期 提交于 2019-12-20 09:10:15
问题 I am trying to get MPNowPlayingInfoCenter to work properly when pausing playback. (I have a streaming music app that uses AVPlayer for playback, and I am playing back in my Apple TV over Airplay.) Everything but pausing seems to be reflected correctly in the Apple TV UI. I am initializing it like this: MPNowPlayingInfoCenter *center = [MPNowPlayingInfoCenter defaultCenter]; NSDictionary *songInfo = @{ MPMediaItemPropertyTitle: title, MPMediaItemPropertyArtist: artist }; center.nowPlayingInfo

AVPlayer was deallocated while key value observers were still registered with it

孤者浪人 提交于 2019-12-20 08:47:15
问题 I am creating a simple media player app. My App is crashed when first link is played and I clicked second link in uitableview. - (void)viewDidLoad { [super viewDidLoad]; arrURL = [NSArray arrayWithObjects: @"http://yp.shoutcast.com/sbin/tunein-station.pls?id=148820", @"http://www.kcrw.com/pls/kcrwmusic.pls",@"http://yp.shoutcast.com/sbin/tunein-station.pls?id=175821",@"http://yp.shoutcast.com/sbin/tunein-station.pls?id=148820",@"http://yp.shoutcast.com/sbin/tunein-station.pls?id=70931",nil];