项目作者: QueenieCplusplus

项目描述 :
Picture in Picture using AVFoundation & AVKit
高级语言: Swift
项目地址: git://github.com/QueenieCplusplus/iOS_Back_10_Video.git
创建时间: 2021-01-28T08:50:06Z
项目社区:https://github.com/QueenieCplusplus/iOS_Back_10_Video

开源协议:

下载


iOS_Back_10_Video

Picture in Picture using AVFoundation & AVKit

  • add mp4 res hereby => Target -> Build Phase -> Copy Bundle Res

  • in Storyboard, using AVKit Player View Controller

  • output

  • code see:

    1. //
    2. // ViewController.swift
    3. // KatesGemVideoApp
    4. //
    5. // Created by KatesAndroid on 2021/1/28 PM 4:00 - 5:00
    6. // 深愛鄧紫棋,謝謝您提供美好和有影響力的音樂給世界!
    7. import UIKit
    8. import AVKit
    9. import AVFoundation
    10. class ViewController: UIViewController {
    11. override func viewDidLoad() {
    12. super.viewDidLoad()
    13. // Do any additional setup after loading the view.
    14. }
    15. // call segue, then prepare method called
    16. override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    17. if let urlForGem = Bundle.main.url(forResource: "gemMusic", withExtension: "mp4"){
    18. let vcForGem = segue.destination as! AVPlayerViewController
    19. vcForGem.player = AVPlayer(url: urlForGem)
    20. }
  1. }
  2. }
  • setup for allowing VideoApp running in Background.