FREE TRIAL: Accelerate your app development career with Hacking with Swift+! >>

Apple Document - Creating a Basic Video Player

Forums > macOS

I followed this document to try and create a streaming video player in a macOS app and I am getting nothing but errors. I am wondering if anyone else get the errors I am encountering? I am using Xcode 12.4 on macOS Big Sur 11.2.3.

Here's my code:

import Cocoa
import AVFoundation
import AVKit

class ViewController: NSViewController {

    @IBOutlet var playerView: AVPlayerView!

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        guard let url = URL(string: "https://devstreaming-cdn.apple.com/videos/streaming/examples/img_bipbop_adv_example_ts/master.m3u8") else {
            return
        }
        // Create a new AVPlayer and associate it with the player view
        let player = AVPlayer(url: url)
        playerView.player = player
    }

    override var representedObject: Any? {
        didSet {
        // Update the view, if already loaded.
        }
    }
}

When I run the code, I get the following errors in the console:

2021-03-27 09:24:44.920720-0500 Streamer[27640:1013041] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x600002e22b60> F8BB1C28-BAE8-11D6-9C31-00039315CD46 2021-03-27 09:24:45.042030-0500 Streamer[27640:1013040] validateSessionInfo: bundleID is invalid. Please specify the bundleID for kRTCReportingSessionInfoClientBundleID 2021-03-27 09:24:45.042972-0500 Streamer[27640:1013054] startConfigurationWithCompletionHandler: Failed to get remote object proxy: Error Domain=NSCocoaErrorDomain Code=4097 "connection to service on pid 0 named com.apple.rtcreportingd" UserInfo={NSDebugDescription=connection to service on pid 0 named com.apple.rtcreportingd} 2021-03-27 09:24:45.043046-0500 Streamer[27640:1013054] startConfigurationWithCompletionHandler: Failed to get remote object proxy: Error Domain=NSCocoaErrorDomain Code=4097 "connection to service on pid 0 named com.apple.rtcreportingd" UserInfo={NSDebugDescription=connection to service on pid 0 named com.apple.rtcreportingd} 2021-03-27 09:24:45.071473-0500 Streamer[27640:1013055] [logging] volume does not support data protection, stripping SQLITE_OPENFILEPROTECTION flags 2021-03-27 09:24:45.072119-0500 Streamer[27640:1013055] [logging] volume does not support data protection, stripping SQLITE_OPENFILEPROTECTION flags 2021-03-27 09:24:45.072665-0500 Streamer[27640:1013055] [logging] volume does not support data protection, stripping SQLITE_OPENFILEPROTECTION flags 2021-03-27 09:24:45.073682-0500 Streamer[27640:1013055] [logging] volume does not support data protection, stripping SQLITE_OPENFILEPROTECTION flags 2021-03-27 09:24:45.074877-0500 Streamer[27640:1013055] [logging] volume does not support data protection, stripping SQLITE_OPENFILEPROTECTION flags 2021-03-27 09:24:45.155189-0500 Streamer[27640:1013055] [logging] volume does not support data protection, stripping SQLITE_OPENFILEPROTECTION flags 2021-03-27 09:24:45.155577-0500 Streamer[27640:1013055] [logging] volume does not support data protection, stripping SQLITE_OPENFILEPROTECTION* flags 2021-03-27 09:24:45.168271-0500 Streamer[27640:1013081] [] nw_resolver_can_use_dns_xpc_block_invoke Sandbox does not allow access to com.apple.dnssd.service 2021-03-27 09:24:45.169487-0500 Streamer[27640:1013081] dnssd_clientstub ConnectToServer: connect() failed path:/var/run/mDNSResponder Socket:7 Err:-1 Errno:1 Operation not permitted 2021-03-27 09:24:45.169606-0500 Streamer[27640:1013081] [connection] nw_resolver_create_dns_service_locked [C1] DNSServiceCreateDelegateConnection failed: ServiceNotRunning(-65563) 2021-03-27 09:24:45.170098-0500 Streamer[27640:1013081] Connection 1: received failure notification 2021-03-27 09:24:45.171183-0500 Streamer[27640:1013081] Connection 1: failed to connect 10:-72000, reason -1 2021-03-27 09:24:45.171229-0500 Streamer[27640:1013081] Connection 1: encountered error(10:-72000) 2021-03-27 09:24:45.172760-0500 Streamer[27640:1013055] Task <9413249A-2C3E-4A40-B71B-394F5E95D197>.<1> HTTP load failed, 0/0 bytes (error code: -1003 [10:-72000]) 2021-03-27 09:24:45.174833-0500 Streamer[27640:1013084] Task <9413249A-2C3E-4A40-B71B-394F5E95D197>.<1> finished with error [-1003] Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found." UserInfo={_kCFStreamErrorCodeKey=-72000, NSUnderlyingError=0x6000020cb030 {Error Domain=kCFErrorDomainCFNetwork Code=-1003 "(null)" UserInfo={_kCFStreamErrorCodeKey=-72000, _kCFStreamErrorDomainKey=10}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <9413249A-2C3E-4A40-B71B-394F5E95D197>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDataTask <9413249A-2C3E-4A40-B71B-394F5E95D197>.<1>" ), NSLocalizedDescription=A server with the specified hostname could not be found., NSErrorFailingURLStringKey=https://devstreaming-cdn.apple.com/videos/streaming/examples/img_bipbop_adv_example_ts/master.m3u8, NSErrorFailingURLKey=https://devstreaming-cdn.apple.com/videos/streaming/examples/img_bipbop_adv_example_ts/master.m3u8, _kCFStreamErrorDomainKey=10} 2021-03-27 09:24:45.175255-0500 Streamer[27640:1013055] validateSessionInfo: bundleID is invalid. Please specify the bundleID for kRTCReportingSessionInfoClientBundleID 2021-03-27 09:24:45.176213-0500 Streamer[27640:1013040] sendOneMessageWithSessionInfo: Failed to get remote object proxy: Error Domain=NSCocoaErrorDomain Code=4097 "connection to service on pid 0 named com.apple.rtcreportingd" UserInfo={NSDebugDescription=connection to service on pid 0 named com.apple.rtcreportingd} 2021-03-27 09:24:45.176282-0500 Streamer[27640:1013081] sendMessageWithDictionary: Failed to get remote object proxy: Error Domain=NSCocoaErrorDomain Code=4097 "connection to service on pid 0 named com.apple.rtcreportingd" UserInfo={NSDebugDescription=connection to service on pid 0 named com.apple.rtcreportingd} 2021-03-27 09:24:45.207079-0500 Streamer[27640:1012591] Metal API Validation Enabled 2021-03-27 09:24:45.233220-0500 Streamer[27640:1013081] fopen failed for data file: errno = 2 (No such file or directory) 2021-03-27 09:24:45.233272-0500 Streamer[27640:1013081] Errors found! Invalidating cache... 2021-03-27 09:24:45.288729-0500 Streamer[27640:1013081] fopen failed for data file: errno = 2 (No such file or directory) 2021-03-27 09:24:45.288805-0500 Streamer[27640:1013081] Errors found! Invalidating cache...

Thanks for any insights.

Tom

   

Hacking with Swift is sponsored by Sentry

SPONSORED With Sentry’s error and performance monitoring for iOS you see mobile vitals that actually matter, can solve any latency issues quickly, and learn how each release is performing over time.

Get started

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.