Skip to content

UI API called on a background thread

Environment:

  • VLCKit 3.0.2 (integrated using Cocoapods)
  • macOS 10.13.4
  • Xcode 9.4
  • Swift 4.1

Expected behavior

let streamURL = URL(string: "http://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_1080p_h264.mov")
            
let playerView = NSView(frame: self.mediaPlayerView!.bounds)
playerView.autoresizingMask = [.width, .height]
self.mediaPlayerView?.addSubview(playerView)
            
self.mediaPlayer.drawable = playerView
            
let media: VLCMedia = VLCMedia(url: streamURL!)
self.mediaPlayer.media = media
            
self.mediaPlayer.play()

Stream should play without errors.

Actual behavior

When starting the playback the Main Thread Checker throws errors:

Main Thread Checker: UI API called on a background thread: -[NSView bounds]
PID: 45432, TID: 3763275, Thread name: (none), Queue name: com.apple.root.default-qos.overcommit, QoS: 21
Backtrace:
4   VLCKit                              0x00000001012bf901 Control + 305
2018-05-31 12:50:41.088367+0200 ThreadIssue[45432:3763275] [reports] Main Thread Checker: UI API called on a background thread: -[NSView bounds]
PID: 45432, TID: 3763275, Thread name: (none), Queue name: com.apple.root.default-qos.overcommit, QoS: 21
Backtrace:
4   VLCKit                              0x00000001012bf901 Control + 305
=================================================================
Main Thread Checker: UI API called on a background thread: -[NSView convertRectToBacking:]
PID: 45432, TID: 3763275, Thread name: (none), Queue name: com.apple.root.default-qos.overcommit, QoS: 21
Backtrace:
4   VLCKit                              0x00000001012bf945 Control + 373
2018-05-31 12:50:41.281648+0200 ThreadIssue[45432:3763275] [reports] Main Thread Checker: UI API called on a background thread: -[NSView convertRectToBacking:]
PID: 45432, TID: 3763275, Thread name: (none), Queue name: com.apple.root.default-qos.overcommit, QoS: 21
Backtrace:
4   VLCKit                              0x00000001012bf945 Control + 373

Steps to reproduce

Please download attached sample project, run pod install and build the project to reproduce the problem.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information