xcode - Dual screen Airplay, balck screen after reload AVPlayer -
i try scroll view multiple video. have blank screen in case:
- i create scroll view
- add
avfoundation
->avplayer
each slide. - each avplayer keep in array
everything works ok, in 1 case black screen. when connect via airplay tv , move scroll view. on videos shows black screen. voice still available. below function show video on dual screen. idea wrong? when checking on simulator works ok.
in debugger problem here: "let avplayerlayer = avplayerlayer(player: o.o)"
func loadcontentsecondscreen() { var ipage:int = self.ispage if (ipage == 0) { ipage = 1 }//end if let oallscreens = uiscreen.screens() // jesli sa podpiete ekrany. if (oallscreens.count > 1 && self.osecondscreen != nil) { // usuwamy stare widoki. if (self.osecondwindow != nil) { view in self.osecondwindow!.subviews { view.removefromsuperview() }//end }//end if // czarne tlo. let view:uiview = uiview(frame: self.osecondscreen!.bounds) view.backgroundcolor = uicolor.blackcolor() self.osecondwindow?.hidden = false self.osecondwindow?.addsubview(view) // jesli sa elementy wyswietlania. if (self.slides > 0) { let obj:galleryasset = self.content[ipage-1] let file:string = obj.zoom let imagecontent:uiview = uiview(frame: self.osecondscreen!.bounds) if (obj.type == "jpg" || obj.type == "jpeg" || obj.type == "png") { // ladujemy obrazy slidera. // czy plik istenieje mozna go zaladowac. if (self.fileexistsinassetfolder(obj.zoom) == true) { let imageimage: uiimage = uiimage(contentsoffile: self.pathasset.stringbyappendingpathcomponent(obj.zoom))! let imageview:uiimageview = uiimageview(image: imageimage) imageview.contentmode = uiviewcontentmode.scaleaspectfill imageview.frame = self.osecondscreen!.bounds imagecontent.addsubview(imageview uiview) } } else if (obj.type == "mp4") { // ladujemy video slidera. if (self.fileexistsinassetfolder(obj.zoom) == true) { let videocontainer:uiview = uiview(frame: self.osecondscreen!.bounds) videocontainer.layer.backgroundcolor = uicolor.blackcolor().cgcolor o in self.avplayerlist { if (ipage-1 == o.i) { //if !o.o { let avplayerlayer = avplayerlayer(player: o.o) avplayerlayer.frame = videocontainer.bounds videocontainer.layer.addsublayer(avplayerlayer) imagecontent.addsubview(videocontainer) //}//end if let }//end if }//end }//end if }//end if self.osecondwindow?.addsubview(imagecontent) } } }//end loadcontentsecondscreen()
Comments
Post a Comment