From 9a1b0dc970062fd2180d19d1e577941de2f3fa50 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hans=20Kn=C3=B6chel?= <hans.knoechel@hs-osnabrueck.de>
Date: Fri, 12 May 2017 16:04:35 +0200
Subject: [PATCH] Support overlay view

---
 facebook-live-ios-sample.xcodeproj/project.pbxproj     | 10 +++++++++-
 facebook-live-ios-sample/FBSDKLiveVideo.swift          | 10 ++++++++++
 .../HKLiveVideoViewController.swift                    |  6 ++++++
 3 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/facebook-live-ios-sample.xcodeproj/project.pbxproj b/facebook-live-ios-sample.xcodeproj/project.pbxproj
index 4e91929..3050bf2 100644
--- a/facebook-live-ios-sample.xcodeproj/project.pbxproj
+++ b/facebook-live-ios-sample.xcodeproj/project.pbxproj
@@ -106,13 +106,21 @@
 		DB9C40811E7055BE00CCBD83 /* Classes */ = {
 			isa = PBXGroup;
 			children = (
+				DBF6E1BF1E8BC1B800875443 /* FBSDKLiveVideo */,
 				DB9C406D1E70527D00CCBD83 /* AppDelegate.swift */,
 				DB9C406F1E70527D00CCBD83 /* HKLiveVideoViewController.swift */,
-				DB40E22F1E71567E009E7C74 /* FBSDKLiveVideo.swift */,
 			);
 			name = Classes;
 			sourceTree = "<group>";
 		};
+		DBF6E1BF1E8BC1B800875443 /* FBSDKLiveVideo */ = {
+			isa = PBXGroup;
+			children = (
+				DB40E22F1E71567E009E7C74 /* FBSDKLiveVideo.swift */,
+			);
+			name = FBSDKLiveVideo;
+			sourceTree = "<group>";
+		};
 /* End PBXGroup section */
 
 /* Begin PBXNativeTarget section */
diff --git a/facebook-live-ios-sample/FBSDKLiveVideo.swift b/facebook-live-ios-sample/FBSDKLiveVideo.swift
index 885a87d..082671c 100644
--- a/facebook-live-ios-sample/FBSDKLiveVideo.swift
+++ b/facebook-live-ios-sample/FBSDKLiveVideo.swift
@@ -89,6 +89,16 @@ open class FBSDKLiveVideo: NSObject {
     // MARK: - Live Video Parameters
     // MARK: Create
     
+    var overlay: UIView! {
+        didSet {
+            if overlay.isDescendant(of: self.preview) {
+                overlay.removeFromSuperview()
+            } else {
+                self.preview.addSubview(overlay)
+            }
+        }
+    }
+    
     var videoDescription: String! {
         didSet {
             self.createParameters["description"] = videoDescription
diff --git a/facebook-live-ios-sample/HKLiveVideoViewController.swift b/facebook-live-ios-sample/HKLiveVideoViewController.swift
index b0d4c28..47cf72e 100644
--- a/facebook-live-ios-sample/HKLiveVideoViewController.swift
+++ b/facebook-live-ios-sample/HKLiveVideoViewController.swift
@@ -39,9 +39,15 @@ class HKLiveVideoViewController: UIViewController {
             videoSize: CGSize(width: 1280, height: 720)
         )
         
+        let myOverlay = UIView(frame: CGRect(x: 5, y: 5, width: self.view.bounds.size.width - 10, height: 30))
+        myOverlay.backgroundColor = UIColor(colorLiteralRed: 0.0, green: 1.0, blue: 0.0, alpha: 0.5)
+        
         self.liveVideo.privacy = .me
         self.liveVideo.audience = "me" // or your user-id, page-id, event-id, group-id, ...
         
+        // Comment in to show a green overlay bar (configure with your own one)
+        // self.liveVideo.overlay = myOverlay
+        
         initializeUserInterface()
     }