Skip to content

Commit

Permalink
Support overlay view
Browse files Browse the repository at this point in the history
  • Loading branch information
hansemannn committed May 12, 2017
1 parent 70ab1a8 commit 9a1b0dc
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
10 changes: 9 additions & 1 deletion facebook-live-ios-sample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
10 changes: 10 additions & 0 deletions facebook-live-ios-sample/FBSDKLiveVideo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions facebook-live-ios-sample/HKLiveVideoViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down

0 comments on commit 9a1b0dc

Please sign in to comment.