avplayer

Does AVPlayer support closed captions delivered in a separate text file?

廉价感情. 提交于 2019-12-22 06:32:32
问题 My team produces iOS apps that play video using AVPlayer. We've recently been told that we MUST allow display of closed captions for all videos... but that the closed captions would not be coming as a track within the video files (we already support closed captions that come in this way). Instead, we'll be getting them as a separate text file. I've seen a couple references to including the caption text file in the SMIL, but I've found nothing about how to incorporate this text file into the

Does AVPlayer support closed captions delivered in a separate text file?

て烟熏妆下的殇ゞ 提交于 2019-12-22 06:32:04
问题 My team produces iOS apps that play video using AVPlayer. We've recently been told that we MUST allow display of closed captions for all videos... but that the closed captions would not be coming as a track within the video files (we already support closed captions that come in this way). Instead, we'll be getting them as a separate text file. I've seen a couple references to including the caption text file in the SMIL, but I've found nothing about how to incorporate this text file into the

How do I replace MPMoviePlayer notifications?

人盡茶涼 提交于 2019-12-22 05:23:20
问题 In iOS 9 MPMoviePlayer and all his components are deprecated. We used MPMoviePlayerController notifications, like MPMoviePlayerLoadStateDidChangeNotification, MPMovieDurationAvailableNotification, MPMoviePlayerPlaybackStateDidChangeNotification, MPMoviePlayerReadyForDisplayDidChangeNotification , to track video service quality. But now with AVPlayerViewController I can't find properly replacement for these notifications. How do I replace these notifications now? 回答1: AVPlayerViewController is

mp4 video starts at different time on Quicktime/AVplayer vs Chrome/Firefox

南笙酒味 提交于 2019-12-22 05:09:18
问题 I have a very strange issue. My OSX app is generating an mp4 video based on a screen cast. For some reason, if I open this video in Quicktime or any OSX-based AVPlayer, it will start about 14-15 frames in advance of frame 0. If I open the mp4 with Chrome or Firefox, it will actually start playing at frame 0. What could cause this ignoring of beginning frames? Here's a screenshot of a timer countdown comparing Quicktime vs Firefox at time zero. Notice how the Firefox player starts at 9:55,

AVPlayer - UILabel not visible over video

本秂侑毒 提交于 2019-12-22 04:42:49
问题 NSString *urlPath; NSURL *videoUrl; urlPath = [[NSBundle mainBundle] pathForResource:@"fogLoop" ofType:@"mp4"]; videoUrl = [NSURL fileURLWithPath:urlPath]; avPlayer = [AVPlayer playerWithURL:videoUrl]; avPlayerLayer = [AVPlayerLayer playerLayerWithPlayer:avPlayer]; avPlayerLayer.frame = videoView.layer.bounds; avPlayerLayer.videoGravity = AVLayerVideoGravityResizeAspectFill; [videoView.layer addSublayer: avPlayerLayer]; avPlayer.actionAtItemEnd = AVPlayerActionAtItemEndNone; [

Playing Streaming Video With AVPlayer

不问归期 提交于 2019-12-22 04:29:52
问题 How do you play a streaming video with AVPlayer ? import Cocoa import AVKit class StreamViewController: NSViewController { var videoPlayer: AVPlayer! @IBOutlet weak var moviePlayerView: AVPlayerView! override func viewDidLoad() { super.viewDidLoad() } override func viewWillAppear() { super.viewWillAppear() } override func viewDidAppear() { super.viewDidAppear() openStream() } func openStream() { completeOpenStream { (done) -> (Void) in if done { print("done!") } } } func completeOpenStream

Seeking accurately, as opposed to two seconds short, in AVPlayer

99封情书 提交于 2019-12-22 02:06:11
问题 I'm using AVPlayer in a Cocoa app, and I've implemented a command that jumps to the end of the video. The problem is, AVPlayer doesn't seek to where I told it to. For example, one of the videos I have is 4 minutes and 14 seconds long. When I seek to the end, AVPlayer seeks to 4 minutes and 12 seconds—two seconds short. If I then hit play, the player will play for two seconds, then reach the end. My first attempt was this: [self.player seekToTime:self.player.currentItem.duration]; I've

Seeking accurately, as opposed to two seconds short, in AVPlayer

牧云@^-^@ 提交于 2019-12-22 02:05:30
问题 I'm using AVPlayer in a Cocoa app, and I've implemented a command that jumps to the end of the video. The problem is, AVPlayer doesn't seek to where I told it to. For example, one of the videos I have is 4 minutes and 14 seconds long. When I seek to the end, AVPlayer seeks to 4 minutes and 12 seconds—two seconds short. If I then hit play, the player will play for two seconds, then reach the end. My first attempt was this: [self.player seekToTime:self.player.currentItem.duration]; I've

Two AVPlayer videos out of sync (Swift)

旧巷老猫 提交于 2019-12-22 01:39:19
问题 I have two AVPlayer() items playing videos of the same duration (10 seconds). The goal is to have them loop and stay in sync with one another. I add them as sublayers of the same UIView and then call player.play() on each one of them. The problem though is that as code execution obviously has the slightest delay as one is called after the other one, the videos are out of sync (although only a few milliseconds, it is noticeable). I do not have the option to create an AVMutableComposition as I

How to mute video played in AVPlayer?

被刻印的时光 ゝ 提交于 2019-12-22 01:26:03
问题 Im playing a video in AVPlayer, and now I need to mute the audio alone while playing it. Please suggest how to do in objective C. Thanks, Suresh 回答1: Since iOS7 you can set the AVPlayer isMuted property to true . In Objective C the property is called muted . Reference: https://developer.apple.com/documentation/avfoundation/avplayer/1387544-ismuted 回答2: This should see you through... AVURLAsset *asset = [[avPlayer currentItem] asset]; NSArray *audioTracks = [asset tracksWithMediaType