avplayerviewcontroller

AVPlayerViewController doesn't play local videos

家住魔仙堡 提交于 2019-12-31 05:18:47
问题 I have added a DemoVideo.mp4 in my project and added it to copy resource file. But when i run the app it doesn't play my video. Here is my method. private func setUpAndPlayVideo() { guard let videoPath = Bundle.main.path(forResource: "DemoVideo.mp4", ofType: nil) else { return } let videoURL = NSURL(string: videoPath) let player = AVPlayer(url: videoURL! as URL) playerViewController = AVPlayerViewController() playerViewController.player = player playerViewController.view.frame = self

Why this Objective-C code won't play an AVPlayerViewController video?

做~自己de王妃 提交于 2019-12-30 05:18:06
问题 Both are in viewDidLoad(). What's wrong with this objective-c source file? The swift version works like a charm... Xcode ver. 8.2 iOS 10 Swift (OK): let path : String = Bundle.main.path(forResource: "charlie", ofType: "mp4")! let movieurl : URL = URL(fileURLWithPath: path) let movie : AVPlayerViewController = AVPlayerViewController() movie.view.frame = self.view.bounds let player : AVPlayer = AVPlayer(url: movieurl) movie.player = player self.view.addSubview(movie.view) player.play()

Unable to simultaneously satisfy constraints Warnings with AVPlayerViewController embedded in storyboard

独自空忆成欢 提交于 2019-12-28 05:56:07
问题 I'm trying to set up an AVPlayerViewController completely through storyboards by embedding in a separate View Controller. Steps: Create Single View Application in Xcode. Embed VC in navigation Controller. Add toolbar at the bottom.(pinned to superView (Leading, Trailing, Bottom Layout Guide, Height(44)). Add container View in parent View Controller.(pinned to superView (Leading, Trailing), Top Layout Guide, toolbar Top). Remove the default View Controller that comes with container view. Drag

No AVPlayer Delegate? How to track when song finished playing? Objective C iPhone development

♀尐吖头ヾ 提交于 2019-12-27 13:34:46
问题 I've looked around but I can't find a delegate protocol for the AVPlayer class . What gives? I'm using its subclass, AVQueuePlayer , to play an array of AVPlayerItems , each loaded from a URL. Is there any way I can call a method when a song finishes playing? Notably at the end of the queue? And if that's not possible, is there any way I could call a method when the song STARTS playing, after buffering? I'm trying to get a loading icon in there but it turns the icon off before the music

How use app closedcaption settings instead of system closed caption settings in ios

∥☆過路亽.° 提交于 2019-12-25 03:22:28
问题 In my application i have closed caption settings and i am using AVPLayer to play video/live content without showing default controls. In my app i can able or disable closed captions like switch based on that switch status i am storing BOOL value in userdefaults. Based on userdefaults i am trying to enable or disable cc for avplayer using below api. [self.player setClosedCaptionDisplayEnabled:enable]; Now problem is Even if i off cc in app but iphone system settings cc enabled that time i am

AVPlayer cannot play video

倾然丶 夕夏残阳落幕 提交于 2019-12-25 03:06:51
问题 I am trying to play a video inside a subclass of JSQMessagesViewController, but it doesn't start playing onClick event. I am downloading the video from firebase, and then I write the data on the device by appending a unique reference -LK7WSGtGAQ2anpDxkCQ . Please see below print out statement for the complete path. //response to collection view tap events //called every time we type on a message override func collectionView(_ collectionView: JSQMessagesCollectionView!, didTapMessageBubbleAt

How to open data instead standart url in AVPlayer

做~自己de王妃 提交于 2019-12-25 02:25:40
问题 How i can open data video file instead standart url in AVPlayer? let videoURL = URL(string: "https://example") but instead URL i have only var dataTs : Data = Data() and i must put it in AVPlayerController let player = AVPlayer(url: videoURL!) playerViewController.player = player 回答1: You don't need to write the data to a temporary file. You can use a named pipe instead. It's very similar to writing to a temporary file, except that it doesn't require any storage space and it's faster. If you

Can't play a YouTube video in tvOS. Got a “Operation requires a client data source to have been registered”

☆樱花仙子☆ 提交于 2019-12-24 08:58:14
问题 When I try to play a YouTube video in tvOS I get the following error: [MediaRemote] [MRPlaybackQueueServiceClient] playbackQueueRequest AFCF4995-D293-4B5B-82F0-E701186F639F PineBoard-21384 /A600.000000x600.000000/R[0:1] responded to asset request with error Error Domain=kMRMediaRemoteFrameworkErrorDomain Code=15 "Operation requires a client data source to have been registered." UserInfo={NSLocalizedDescription=Operation requires a client data source to have been registered.} I'm using the

Sync video in AVPlayerLayer and AVPlayerViewController

天大地大妈咪最大 提交于 2019-12-23 19:21:03
问题 I'm working with AVPlayer to show the playing video using a URL in it. There are 2 parts to it: 1. Firstly, I've embedded the AVPlayer to a view's sublayer using AVPlayerLayer , i.e. var player: AVPlayer? func configure() { let urlString = "https://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4" if let url = URL(string: urlString) { self.player = AVPlayer(url: url) let playerLayer = AVPlayerLayer(player: self.player) playerLayer.frame = self.view.bounds self.view.layer.addSublayer(playerLayer)

How to handle Menu Button action in tvOS remote

最后都变了- 提交于 2019-12-23 18:24:23
问题 I am facing the strange problem with my application. Actually when i am presenting a view controller for play the video. At the video load time user press the menu button the application goes to background. While i have overwrite the Menu Button Action. This is my code. override func viewWillAppear(animated: Bool) { let menuPressRecognizer = UITapGestureRecognizer() menuPressRecognizer.addTarget(self, action: #selector(VideoPlayerViewController.menuButtonAction(_:))) menuPressRecognizer