avplayer

Place AVPlayerViewController inside UIView

感情迁移 提交于 2019-12-23 12:28:52
问题 Currently I am having a dialogue view with four controls at the bottom. Each control is loading a different view inside the dialogue. One of these controls is setting an AVPlayer inside the dialogue view and is playing it. Unfortunately the AVPlayer itself comes without playback controls. The AVPlayerViewController how ever does have playback controls. Is it possible to place a AVPlayerViewController inside a UIView so that it does not get started as a new screen? I would like to place it

Play a specific part of video

杀马特。学长 韩版系。学妹 提交于 2019-12-23 05:09:48
问题 I want to play a specific part of the video using AVPlayerController . But don't know how to play. Here is my code func playVideoMethod(path:URL) { avpController = AVPlayerViewController() avpController.player = AVPlayer.init(url: path) avpController.view.frame = self.playerView.bounds avpController.showsPlaybackControls = false let translate = CGAffineTransform(rotationAngle: CGFloat(Int(M_PI/18.0))) avpController.view.transform = translate self.playerView.addSubview(avpController.view) self

Security Scoped Bookmark - bookmark resolves but still can't access the file

萝らか妹 提交于 2019-12-23 03:52:08
问题 EDIT: Additional information added at the bottom I have a sandboxed, document based application that loads a user selected quicktime movie into an AVPlayer, and everything was working perfectly. Now I am upgrading the code so that it will use Security Scoped bookmarks to get the URL rather than just storing a URL string so that the persistent store will allow the movie to be loaded upon relaunch of the application. When the bookmark is created it is stored in a Data variable of a managed

AVplayer not showing in ScrollView after 2-3 times

拟墨画扇 提交于 2019-12-23 03:07:09
问题 I am adding multiple AVPlayer objects in a scrollview. For the first time this is working fine but as i go back to my previous view and come back again i am not able to see AVPlayer objects in scrollView. I need as matrix of multiple AVPlayer to show thumbnails of my videos. Please help me asap Thanks in advance. 回答1: I had a similar problem and after a lot of searching discovered that the AVPLayerItem object causes this issue. Basically when the AVPlayer items go offscreen you need to make

AVPlayer on left side of cell works perfectly. AVPlayer on right side of cell does not work

非 Y 不嫁゛ 提交于 2019-12-23 02:17:23
问题 I have UITableView cells, each with 2 AVPlayers. One on the right side, and one on the left side. And to go along with this, 2 AVPlayerLayers, 2 AVPlayerItems, etc. Exact same setup on each side of the cell. Except, the video on the right side of the cell does not play. Here is the code that plays the video just perfectly on the left side: - (void)playVideoOnLeftFromCache:(CompletedTableViewCell *)videoCell { videoCell.contentView.backgroundColor = [UIColor clearColor]; videoCell.redView = [

AVPlayer play SKVideoNode video ,I just can not control the playback

房东的猫 提交于 2019-12-23 01:29:13
问题 I am using the SpriteKit to play video,this is my code to create the SKVideoNode from AVPlayer: func CreateVideoViewWithAVPlayer(player:AVPlayer) { video = SKVideoNode(AVPlayer: player) let frameLayer=AVPlayerLayer(player: player) //video?. = CGRectMake(0, 0, 100, 100) video?.size = CGSize(width: 1024, height: 768) println(player.currentItem) video?.anchorPoint = CGPoint(x: 0, y: 0) video?.position = CGPoint(x: 0, y: 0) backgroundColor = SKColor.blackColor() self.addChild(video!) } And I

Shift AVPlayer captions when subview overlaps them

与世无争的帅哥 提交于 2019-12-22 12:18:26
问题 Is it possible to shift the system captions that display for a video should a subview (non-native, custom player controls) appear over them? The captions displayed are text WebVTT captions. On certain screen sizes, when I shift to landscape, our custom seek bar controls overlap captions that appear at the bottom of the player. 回答1: For what it's worth, this is possible. You need to access the AVPlayer's current item and set an AVTextStyleRule for it. // currentPlayer is our instance of the

AVPlayer boundary time observer fails to fire occasionally

末鹿安然 提交于 2019-12-22 11:05:27
问题 I'm using AVPlayer's -addBoundaryTimeOserverForTimes:queue:usingBlock: to execute some code at a specific time in my video (in this case, I want a un-hide a button when my video reaches its duration. Code is as follows: - (void)viewWillAppear:(BOOL)animated { ... _player = [AVPlayer playerWithURL:videoURL]; AVPlayerLayer *newPlayerLayer = [AVPlayerLayer playerLayerWithPlayer:_player]; [newPlayerLayer setFrame:_videoView.bounds]; [_videoView.layer addSublayer:newPlayerLayer]; _observer = [

AVPlayer item buffer empty

北城以北 提交于 2019-12-22 08:24:29
问题 I use AVPlayer that plays stream content. I want to know the time when buffer is empty and the time when it is ready to play. But the observers "playbackBufferEmpty" and "playbackLikelyToKeepUp" do not work every time as it needed. They sometimes work but often do not work. I use only iPad simulator iOS 6.1 under OSX 10.7.5. Here is how i set and listen observers: - (void)playAudioStream:(NSURL *)audioStreamURL { if(_audioPlayer && _audioPlayer.currentItem) { [_audioPlayer removeObserver:self

AVPlayer item buffer empty

断了今生、忘了曾经 提交于 2019-12-22 08:22:07
问题 I use AVPlayer that plays stream content. I want to know the time when buffer is empty and the time when it is ready to play. But the observers "playbackBufferEmpty" and "playbackLikelyToKeepUp" do not work every time as it needed. They sometimes work but often do not work. I use only iPad simulator iOS 6.1 under OSX 10.7.5. Here is how i set and listen observers: - (void)playAudioStream:(NSURL *)audioStreamURL { if(_audioPlayer && _audioPlayer.currentItem) { [_audioPlayer removeObserver:self