I get this error when I try to play multiple videos using this quick library ( https://github.com/piemonte/player ). Not sure if this is related to this player or to a framework or something else.
What happens, I have a view that will display either a photo or a video. Everything works fine several times until several videos are played, and then this message appears, followed by all the videos that cannot be played, and in their place you see a black screen, and then I get a memory usage error.
I am using a library called SwipeView, and here is some relevant code that might be useful.
func swipeView(swipeView: SwipeView!, viewForItemAtIndex index: Int, reusingView view: UIView!) -> UIView! { let asset: PHAsset = self.photosAsset[index] as PHAsset // Create options for retrieving image (Degrades quality if using .Fast) // let imageOptions = PHImageRequestOptions() // imageOptions.resizeMode = PHImageRequestOptionsResizeMode.Fast var imageView: UIImageView! let screenSize: CGSize = UIScreen.mainScreen().bounds.size let targetSize = CGSizeMake(screenSize.width, screenSize.height) var options = PHImageRequestOptions() options.resizeMode = PHImageRequestOptionsResizeMode.Exact options.synchronous = true if (asset.mediaType == PHAssetMediaType.Image) { PHImageManager.defaultManager().requestImageForAsset(asset, targetSize: targetSize, contentMode: .AspectFill, options: options, resultHandler: {(result, info) in if (result.size.width > 200) { imageView = UIImageView(image: result) } }) return imageView } else if (asset.mediaType == PHAssetMediaType.Video) { self.currentlyPlaying = Player() PHImageManager.defaultManager().requestAVAssetForVideo(asset, options: nil, resultHandler: {result, audio, info in self.currentlyPlaying.delegate = self self.currentlyPlaying.playbackLoops = true self.addChildViewController(self.currentlyPlaying) self.currentlyPlaying.didMoveToParentViewController(self) var t = result as AVURLAsset var url = t.valueForKey("URL") as NSURL var urlString = url.absoluteString self.currentlyPlaying.path = urlString }) return self.currentlyPlaying.view } return UIView() } func swipeViewItemSize(swipeView: SwipeView!) -> CGSize { return self.swipeView.bounds.size; } func swipeView(swipeView: SwipeView!, didSelectItemAtIndex index: Int) { self.currentlyPlaying.playFromBeginning() } func swipeViewCurrentItemIndexDidChange(swipeView: SwipeView!) { self.currentlyPlaying.stop() }
Any thoughts would be wonderful.
source share