Posts

Post not yet marked as solved
3 Replies
2.9k Views
Has anyone figured this out.It seems replaykit 2 always delevers frames at a fixed resolution of 886 x 1918I've tried various solutions to rotate the screen but so far none work.Using the code below crashes in the rotate stepvImageRotate90_ARGB8888(&srcBuffer, &destBuffer, factor, &color, vImage_Flags(0)) let flags = CVPixelBufferLockFlags(rawValue: 0) guard kCVReturnSuccess == CVPixelBufferLockBaseAddress(srcPixelBuffer, flags) else { return nil } defer { CVPixelBufferUnlockBaseAddress(srcPixelBuffer, flags) } guard let srcData = CVPixelBufferGetBaseAddress(srcPixelBuffer) else { print("Error: could not get pixel buffer base address") return nil } let sourceWidth = CVPixelBufferGetWidth(srcPixelBuffer) let sourceHeight = CVPixelBufferGetHeight(srcPixelBuffer) var destWidth = sourceHeight var destHeight = sourceWidth var color = UInt8(0) if factor % 2 == 0 { destWidth = sourceWidth destHeight = sourceHeight } let srcBytesPerRow = CVPixelBufferGetBytesPerRow(srcPixelBuffer) var srcBuffer = vImage_Buffer(data: srcData, height: vImagePixelCount(sourceHeight), width: vImagePixelCount(sourceWidth), rowBytes: srcBytesPerRow) let destBytesPerRow = destWidth*4 guard let destData = malloc(destHeight*destBytesPerRow) else { print("Error: out of memory") return nil } var destBuffer = vImage_Buffer(data: destData, height: vImagePixelCount(destHeight), width: vImagePixelCount(destWidth), rowBytes: destBytesPerRow) let error = vImageRotate90_ARGB8888(&srcBuffer, &destBuffer, factor, &color, vImage_Flags(0)) if error != kvImageNoError { print("Error:", error) free(destData)
Posted Last updated
.
Post not yet marked as solved
0 Replies
1k Views
The SfSafariViewController is a poor replacemet for UIWebview, IOS 12 deprecates UIWebview so we have decided to not use itbut we are left with two possibilities .SFSafariVeiwControllerwKwebviewIn experimenting we found that our DRM conent which played well in UiWebView no longer plays in WKwebView , that is ashow stopper and seems like a bad omission for Apple which is pushing WkwebView as the replacement for UIwebView.So we are stuck with SFSafariViewControllerbut this webView has so many issues.We need to implement touch gestures when azure media player goes into full screen mode, but rather than displaying in the full screen browser on the iphone selecting full screen shells out to a player.There does not seen to be anyway to attach gestures to that AVplayerViewController instanceAfter some experiementation i Subclassed SFSafariViewController and created a custom toolbar at the bottom of the diiplay and placed a fullscreen button which launches AVplayerViewcontroller.if I launch from the safariview controller , the player never appears and I get an error message that I am attempting to present a view from a veiwcontroller not in the hierachy.If I present of of sf (safariviewcontroller) presenting view controller , the avpllayer does launch, but when I close AvPlayerViewController SFsafariviewcontroller is present again but both my custon button and the done button are disabled.Its so frustrating because there just doesn't seem much you can do to customize this controller, UIwebView was so much better than the substitutes.Here is my cust SafariViewControllerimport UIKit import SafariServices import Material class SCSafariViewcontroller: SFSafariViewController { var toolView : Toolbar! var clearbutton : IconButton! var fileId:String! override func viewDidLoad() { super.viewDidLoad() // clearbutton.addTarget(self, action: #selector(handleClearButton), for: .touchUpInside) // Do any additional setup after loading the view. } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) var frame = self.view.frame let OffsetY: CGFloat = 44 frame.origin = CGPoint(x: frame.origin.x, y: frame.origin.y - OffsetY) frame.size = CGSize(width: frame.width, height: frame.height + (1 * OffsetY)) // self.view.frame = frame Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(SCSafariViewcontroller.drawNavBar), userInfo: nil, repeats: false) } override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) print("this") } override func viewDidLayoutSubviews() { super.viewDidLayoutSubviews() print("i laid out my subviews") } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } @objc func setFullScreenPlay() { clearbutton = IconButton(image: UIImage(named: "ic_fullscreen_36"), tintColor: UIColor.darkText) } @objc func drawNavBar() { var height: CGFloat! var y: CGFloat! if UIDevice.current.orientation.isLandscape { print("Landscape") height = 44 y = self.view.frame.height - height } else { print("Portrait") height = 85 y = self.view.frame.height - height } // It can be any overlay. May be your logo image here inside an imageView. // let overlay = UIView(frame: CGRect(x: 0, y: y, width: self.view.frame.width, height: height)) toolView = Toolbar() toolView.frame = CGRect(x : 0 , y : y , width : self.view.frame.width , height : height) toolView.width = self.view.width toolView.rightViews = [clearbutton] toolView.titleLabel.font = RobotoFont.regular(with: 14) // toolView.titleLabel.text = "Viewer" toolView.titleLabel.textAlignment = .left toolView.dividerAlignment = .top toolView.backgroundColor = UIColor.gray self.view.addSubview(toolView) } @objc func handleClearButton() { } override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { DispatchQueue.main.async() { self.toolView.removeFromSuperview() Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(SCSafariViewcontroller.drawNavBar), userInfo: nil, repeats: false) } } }And here is how I am trying to present , tried with dimissing and reopening he controller and without, same issues //vc.dismiss(animated: true, completion: { DispatchQueue.main.async() { pvc?.modalPresentationStyle = UIModalPresentationStyle.popover self.vc.navigationController?.present(playerViewController, animated: true, completion: { AssetPlaybackManager.sharedManager.setAssetForPlayback(asset) }) } })
Posted Last updated
.
Post not yet marked as solved
2 Replies
1.1k Views
Is there a way to use a WKwebview to play back encrypted video.We want to use a hosted player and so far the best I can achieve is using a SafariViewController which gives usvery limited options in terms of presentation.We would like to be able to have the webview on a page with other components.Is there anyway to use custom protocol or some similar tech that would allow using AVAssetResourceLoaderDelegateto provide the content Key for the Fairplay cert.We use Azure player is their any way to utilize that.
Posted Last updated
.
Post not yet marked as solved
0 Replies
521 Views
We have an Azure streaming server we want to use with Fairplay , we configure content protection with fairplay for HLS using our certificate and secretall looks ok.But when we go to play the stream we get the following error message.MPE_INVALID_ASSET_DELIVERY_POLICY_TYPE
Posted Last updated
.