Apple iOS
The steps below will integrate ParOne into your iOS app.
Preflight
Prior to integrating ParOne, make sure the following as been completed:
- Your organization has created a feed.
Integrating ParOne
For iOS apps, instantiate a WkWebView object and load our script tag and the single Video Block.
Replace YOUR_FEED_ID
with your Feed ID, and the CONTENT_KEY
with a content-key from the JSON or RSS feed.
YOUR_URL_HERE
should be the same URL for your domain associated with your Ad server to ensure ads play correctly.
class ViewController: UIViewController, WKUIDelegate {
var webView: WKWebView!
override func loadView() {
let webConfiguration = WKWebViewConfiguration()
webConfiguration.allowsAirPlayForMediaPlayback = true
webConfiguration.mediaTypesRequiringUserActionForPlayback = .audio
webConfiguration.allowsInlineMediaPlayback = true
webConfiguration.allowsPictureInPictureMediaPlayback = true
webView = WKWebView(frame: .zero, configuration: webConfiguration)
webView.uiDelegate = self
view = webView
}
override func viewDidLoad() {
super.viewDidLoad()
webView.loadHTMLString("
<html>
<head>
<script src='https://sdk.parone.io/parone.min.js'></script>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0'></meta>
</head>
<body>This is a video test<br>
<parone-video-block
feed='YOUR_FEED_ID'
content-key='CONTENT_KEY'>
</parone-video-block>
</html>",
baseURL: URL(string: "YOUR_URL_HERE"))
}
}
Additional Settings
NOTE In addition, you should add the Audio, AirPlay and Picture in Picture capabilties in your Background modes. Apple’s documentation has more information with adding this feature.
NOTE For capturing fullscreen events, seeWebView Events has more information with adding this feature.