ios - How to play 2 video at the same time? -


i'am trying play 2 video in 1 screen via mpmovieplayercontroller everytime 1 of them plays. playvideo function:

func playvideo() {     let url = nsurl(string: videourls[videonumber])     movieplayer = mpmovieplayercontroller(contenturl: url)     if let player = movieplayer {         player.view.frame = cgrect(x: 0, y: 200, width: 200, height: 200)         player.shouldautoplay = true         player.preparetoplay()         player.scalingmode = .aspectfill         player.controlstyle = .none         player.allowsairplay = false         self.view.addsubview(player.view)     }      let backurl = nsurl(string: videourls[videonumber+1])     backplayer = mpmovieplayercontroller(contenturl: backurl)     if let player = backplayer {         player.view.frame = cgrect(x: 0, y: 0, width: 200, height: 200)         player.shouldautoplay = true         player.preparetoplay()         player.scalingmode = .aspectfill         player.controlstyle = .none         player.allowsairplay = false         self.view.addsubview(player.view)     } 

refer docs:

note

although can create multiple mpmovieplayercontroller objects , present views in interface, 1 movie player @ time can play movie.

if want able play 2 movies @ once, check out avplayerlayer , avsynchronizedlayer


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -