Questions tagged [avkit]

AVKit is an API developed by Apple Inc.

That comes with OS X Mavericks 10.9+ and can be used with Xcode 5.0+ for developing audio and movie software for Mac .

The AVKit software framework is going to eventually replace QuickTime which is now deprecated.

344 questions
3
votes
1 answer

SwiftUI, How to resize a video to fill all vertical (iPhone) while maintaining aspect ratio (left and right not visible edges off screen)

I have a video that is suitable for viewing on a tv or laptop (i.e. landscape dominant). I need to make this video fill an iPhone screen vertically without stretching the video out of aspect. Consequently much of the left and right of the video…
3
votes
0 answers

How to use AVCaptureVideoPreviewLayer to display with PiP?

I am trying to use the AVCaptureVideoPreviewLayer with PiP like this: if #available(iOS 15.0, *) { let pipVideoCallViewController = AVPictureInPictureVideoCallViewController() pipVideoCallViewController.preferredContentSize =…
Matheus Weber
  • 194
  • 2
  • 3
  • 14
3
votes
1 answer

Can AVAssetResourceLoader (and AVAssetResourceLoaderDelegate) be used to limit the choices of streams to increase quality?

iOS (seemingly especially with iOS 15), isn't always the best at taking an HLS m3u8 playlist with multiple playback quality options and selecting the best one to play. For instance even with a great internet connection, iOS will often pick one of…
3
votes
1 answer

Split video into chunks of 30 seconds Ios swift 5

I've been trying to let user choose from video gallery and split video to chunks of 30 seconds! When I select a video of 1 minute, it splits to two videos of 30 seconds each, and it works fine! I tried another example of video 35 seconds, and it…
Nasser FN
  • 59
  • 8
3
votes
1 answer

How to manage AVPlayer state in SwiftUI

I have a list of URLs in SwiftUI. When I tap an item, I present a full screen video player. I have an @EnvironmentObject that handles some viewer options (for example, whether to show a timecode). I also have a toggle that shows and hides the…
ADB
  • 591
  • 7
  • 21
3
votes
1 answer

Playing local video files in macOS SwiftUI application using AVPlayer

I am trying to create a simple SwiftUI application using XCode 11.5 on macOS 10.15.4 using AVKit/AVFoundation to play videos stored on the local file system. I would like to be able to select the movie based on a file path determined by the user's…
crispedman
  • 71
  • 7
3
votes
0 answers

Write chunks of video to memory and stream them in AVKit

I am making a file encryption app in Swift for iOS. I want to support video files using the stock, native system video player. I currently have code that does it well, but it falls short because of one issue - if the file is too big, the app fills…
OmerFlame
  • 147
  • 1
  • 7
3
votes
2 answers

Close Picture in Picture video when user choses a new video to play

I'm using AVKit to show videos to a user. When the user selects a video it is presented using the standard player from AVKit. This makes it fullscreen. If the user elects to make it 'Picture in Picture' the user is able to continue using the rest…
iOSProgrammingIsFun
  • 1,418
  • 1
  • 15
  • 32
3
votes
2 answers

ReplayKit: RPScreenRecorder.shared().startCapture() NOT WORKING

ReplayKit has really been frustrating me recently. For some reason RPScreenRecorder.shared().startCapture(handler: { (sample, bufferType, error) in does not actually work when I call it because I have a print() statement inside it and it is never…
J.Treutlein
  • 963
  • 8
  • 23
3
votes
4 answers

Reducing the size of a video exported with AVAssetExportSession - iOS Swift

I'm currently exporting a video in the following way: let exporter = AVAssetExportSession.init(asset: mixComposition, presetName: AVAssetExportPreset1280x720) exporter?.outputURL = outputPath exporter?.outputFileType = AVFileType.mp4 …
thelearner
  • 1,440
  • 3
  • 27
  • 58
3
votes
3 answers

Disable gesture recognizer in AVPlayerViewController

In AVPlayerViewController there is a feature for stopping the playback of a video and closing the AVPlayerViewController by swiping its view. I want to disable this feature. I guess I need to disable a gesture recognizer!? But I don’t know how to…
Emily94
  • 75
  • 6
3
votes
1 answer

Disable "drag" function for AVPlayer

My app plays videos for toddlers. It uses AVPlayer. In a recent update Apple has implemented the function of dragging the video view to close it. This doesn't work well with toddlers touching the screen all the time. Does anyone know how to disable…
Emily94
  • 75
  • 6
3
votes
3 answers

Composing Video and Audio - Video's audio is gone

My question is, I am using the function below, to compose a video and audio. I want to keep video's original sound but it goes away somehow, I do not have any clue. I got this function from this answer I tried to change volumes right after…
Faruk
  • 2,269
  • 31
  • 42
3
votes
0 answers

AVPlayer autostart in SceneKit

I have an AVPlayer used in SpriteKit as a material of SceneKit node. However, the AVPlayer will always auto start! I have tried to put the code in viewDidLoad or viewWillAppear (as some answers), but it still load automatically. My code is something…
Lim Thye Chean
  • 8,704
  • 9
  • 49
  • 88
3
votes
3 answers

How to resume audio playing of other apps after dismissing AVPlayerViewController?

I use AVPlayerViewController to play short videos in my app. If there is an app playing audio in background before user plays a video in my app, I want the background audio playing of the other app to resume after my video player is dismissed. I…
an0
  • 17,191
  • 12
  • 86
  • 136