Skip to content

Instantly share code, notes, and snippets.

@zaxy78
Last active May 2, 2020 12:21
Show Gist options
  • Save zaxy78/0ffbb98f0cc61bb8a1feca27f903409e to your computer and use it in GitHub Desktop.
Save zaxy78/0ffbb98f0cc61bb8a1feca27f903409e to your computer and use it in GitHub Desktop.
Displaying WebRTC PeerConnection sample in a iOS WKWebView
//
// ViewController.swift
// WKWebView with adapter.js Sample
//
// To use this file, simply create a new empty 'Single View App'
// in Xcode, and replace ViewController.swift content to this.
//
// Created by Sachs, Aviad on 5/3/18
// Copyright © 2017 Sachs, Aviad. All rights reserved.
//
import UIKit
import WebKit
class ViewController: UIViewController {
var webView: WKWebView = WKWebView()
override func viewDidLoad() {
super.viewDidLoad()
view.addSubview(webView)
let url = URL(string: "https://webrtc.github.io/samples/src/content/peerconnection/pc1/")!
webView.load(URLRequest(url: url ))
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
@zaxy78
Copy link
Author

zaxy78 commented Mar 5, 2018

Suggested a fix (#783) to current adapter.js version (6.1.1) to allow support for WKWebViews

@alex305cde
Copy link

HI, I did a simple xcode page but when I know the url, i cannot start the video call.
anything can make it work? and how to include adapter.js?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment