SWPreviewRecorderViewController

class SWPreviewRecorderViewController : SWBaseViewController, CLLocationManagerDelegate, AVCaptureVideoDataOutputSampleBufferDelegate, AVCaptureAudioDataOutputSampleBufferDelegate, AgoraRtcEngineDelegate, UIGestureRecognizerDelegate, SWPopOverViewControllerDelegate

Undocumented

  • Undocumented

    Declaration

    Swift

    @IBOutlet
    weak var waitingSwipBarBtn: UIButton!
  • Undocumented

    Declaration

    Swift

    @IBOutlet
    weak var liveSwipBarBtn: UIButton!
  • Undocumented

    Declaration

    Swift

    @IBOutlet
    weak var goBackBtn: UIButton!
  • IBOutlet to UIView to show camera preview.

    Declaration

    Swift

    @IBOutlet
    weak var cameraView: UIView!
  • IBOutlet to record button.

    Declaration

    Swift

    @IBOutlet
    weak var recordBtn: UIButton!
  • UIView contains record button and it’s white stroke.

    Declaration

    Swift

    @IBOutlet
    weak var recordBtnView: UIView!
  • UIView contains record button yellow animated stroke.

    Declaration

    Swift

    @IBOutlet
    weak var recordBtnYellowStrokeView: UIView!
  • Animated yellow stroke of record button.

    Declaration

    Swift

    var recordBtnYellowStroke: CAShapeLayer!
  • IBOutlet to swift front / back camera button.

    Declaration

    Swift

    @IBOutlet
    weak var switchCameraBtn: UIButton!
  • IBOutlet to close button.

    Declaration

    Swift

    @IBOutlet
    weak var closeBtn: UIButton!
  • Tappable UIView contains Broadcast’s description and Channel labels.

    Declaration

    Swift

    @IBOutlet
    weak var descriptionAndChannelView: UIView!
  • UILabel for broadcast description.

    Declaration

    Swift

    @IBOutlet
    weak var descriptionLbl: UILabel!
  • UILabel for broadcast channel.

    Declaration

    Swift

    @IBOutlet
    weak var channelLbl: UILabel!
  • UIView blinking as typing cursor for broadcast description.

    Declaration

    Swift

    @IBOutlet
    weak var descriptionblinkingView: UIView!
  • UIView contains Broadcast description and channel labels and used to dim Camera view.

    Declaration

    Swift

    @IBOutlet
    weak var dimView: UIView!
  • UIButton to enable / disable broadcast location.

    Declaration

    Swift

    @IBOutlet
    weak var locationBtn: UIButton!
  • UIView contains all of Live or Waiting Room UI views.

    Declaration

    Swift

    @IBOutlet
    weak var liveOrWaitingRoomView: UIView!
  • Record broadcast button to start a deferred broadcast. This button is visible for only selected users.

    Declaration

    Swift

    @IBOutlet
    weak var recordBroadcsatBtn: UIButton!
  • Undocumented

    Declaration

    Swift

    @IBOutlet
    weak var liveRoomBtn: UIButton!
  • Undocumented

    Declaration

    Swift

    @IBOutlet
    weak var liveSwitch: UISwitch!
  • Undocumented

    Declaration

    Swift

    @IBOutlet
    weak var waitingRoomBtn: UIButton!
  • The bar which Live or Waiting Room draggable button is dragged over.

    Declaration

    Swift

    @IBOutlet
    weak var liveOrWaitingRoomBarView: UIView!
  • UIView acts as draggable button for choosing to go to Live or Waiting Room.

    Declaration

    Swift

    @IBOutlet
    weak var liveOrWaitingRoomDraggableView: UIView!
  • UI constraint to limit dragging to left side.

    Declaration

    Swift

    @IBOutlet
    weak var draggableBtnLeftConstraint: NSLayoutConstraint!
  • UI constraint to position draggable button at horizontal center of the bar.

    Declaration

    Swift

    @IBOutlet
    weak var DraggableBtnCenterConstraint: NSLayoutConstraint!
  • UI constraint to limit dragging to right side.

    Declaration

    Swift

    @IBOutlet
    weak var draggableBtnRightConstraint: NSLayoutConstraint!
  • UIView contains Connecting Network label and progress bar.

    Declaration

    Swift

    @IBOutlet
    weak var connectingNetworkView: UIView!
  • UIView used to simulate infinite progress bar.

    Declaration

    Swift

    @IBOutlet
    weak var progressBarView: UIView!
  • UI constraints used to animate infinite progress bar.

    Declaration

    Swift

    @IBOutlet
    weak var progressBarLeftConstraint: NSLayoutConstraint!
  • Undocumented

    Declaration

    Swift

    @IBOutlet
    weak var progressBarRightConstraint: NSLayoutConstraint!
  • UIView to be shown network error occurs or network bandwidth is not sufficient.

    Declaration

    Swift

    @IBOutlet
    weak var networkErrorView: UIView!
  • Undocumented

    Declaration

    Swift

    @IBOutlet
    weak var addShowButton: UIButton!
  • Undocumented

    Declaration

    Swift

    @IBOutlet
    weak var faceBookPostButton: UIButton!
  • Undocumented

    Declaration

    Swift

    @IBOutlet
    weak var twitterPostButton: UIButton!
  • Undocumented

    Declaration

    Swift

    fileprivate var sharePermissionAskedForTwitter: Bool
  • Undocumented

    Declaration

    Swift

    fileprivate var onlyPostPermissionRequired: Bool
  • Undocumented

    Declaration

    Swift

    @IBOutlet
    weak var addShowButtonImageView: UIImageView!
  • Boolean value to indicate if front camera is currently selected.

    Declaration

    Swift

    var isFrontCameraSelected: Bool
  • UIImage for back camera selected icon for switch camera button.

    Declaration

    Swift

    lazy var backCameraIcon: UIImage { get set }
  • UIImage for from camera selected icon for switch camera button.

    Declaration

    Swift

    lazy var frontCameraIcon: UIImage { get set }
  • AVCaptureSession used for video and audio capturing.

    Declaration

    Swift

    var cameraSession: AVCaptureSession!
  • CALayer used to show camera’s video.

    Declaration

    Swift

    weak var previewLayer: AVCaptureVideoPreviewLayer?
  • AVPlayer used to play recorded preview.

    Declaration

    Swift

    var player: AVPlayer?
  • AVPlayerLayer used to show recorded preview at the view.

    Declaration

    Swift

    var playerLayer: AVPlayerLayer?
  • Timer used for updating UI according to recording progress.

    Declaration

    Swift

    var recordingProgressTimer: Timer?
  • Holds time when recording started. Used to update UI and limit recording to 10 seconds.

    Declaration

    Swift

    var recordingStartTimeStamp: CMTime?
  • Holds time of last recorded data sample.

    Declaration

    Swift

    var lastRecordedTimeStamp: CMTime?
  • this is the minimum bandwidth allowed for the broadcaster to broadcast

    Declaration

    Swift

    var minimumNetworkbandWidthAllowed: Double
  • bitrate Calculate recording duration according to first and last recorded samples time stamps.

    Declaration

    Swift

    var currentRecordingDuration: Float64 { get }
  • Timer used to animate progress bar while playing.

    Declaration

    Swift

    var playingProgressTimer: Timer?
  • TODO:- This is a quick fix.

    Declaration

    Swift

    var lastBroadcastDetails: BroadcastDetails?
  • AVAssetWriter used to write video file.

    Declaration

    Swift

    var videoWriter: AVAssetWriter!
  • AVAssetWriterInput used to pass video data from AVCaptureVideoDataOutput to AVAssetWriter

    Declaration

    Swift

    var videoWriterInput: AVAssetWriterInput!
  • AVCaptureVideoDataOutput used to pass video data from AVCaptureSession to AVAssetWriterInput

    Declaration

    Swift

    var videoDataOutput: AVCaptureVideoDataOutput!
  • Boolean value to indicate if captured data from capture session should be recorded to video file.

    Declaration

    Swift

    var isRecording: Bool
  • UIImage representation of a screenshot took during recording preview.

    Declaration

    Swift

    var screenshot: UIImage?
  • Instance of location manager used to check and request for location permission.

    Declaration

    Swift

    let locationManager: CLLocationManager
  • Boolean value indicate that is view controller was sent to background while supposed to enable location services.

    Declaration

    Swift

    var isSupposedToEnableLocation: Bool
  • Undocumented

    Declaration

    Swift

    var rtcEngine: AgoraRtcEngineKit!
  • Undocumented

    Declaration

    Swift

    var broadcastProperties: BroadcastProperties
  • Undocumented

    Declaration

    Swift

    var pageScrollView: UIScrollView?
  • Undocumented

    Declaration

    Swift

    var gestureScrollView: UIScrollView?
  • Undocumented

    Declaration

    Swift

    var pageControl: UIPageControl?
  • Undocumented

    Declaration

    Swift

    var titleEntryViewArray: [UIView]
  • Undocumented

    Declaration

    Swift

    var currentVisiblePage: Int
  • Undocumented

    Declaration

    Swift

    var showItemListModel: SWShowItemListModel
  • Undocumented

    Declaration

    Swift

    var lastEpisodeCreated: Int?
  • Undocumented

    Declaration

    Swift

    @IBOutlet
    weak var scheduleLabel: UILabel!
  • Undocumented

    Declaration

    Swift

    var swBroadcastCardModelList: [SWBroadcastDescCardModel]
  • Undocumented

    Declaration

    Swift

    var broadcastOptions: SWBroadcastOptionsViewController?
  • Undocumented

    Declaration

    Swift

    @IBOutlet
    weak var previewBgImage: UIImageView!
  • Undocumented

    Declaration

    Swift

    var openGalleryPickerController: UIImagePickerController
  • Undocumented

    Declaration

    Swift

    var stillCameraOutput: AVCaptureStillImageOutput!
  • Undocumented

    Declaration

    Swift

    @IBOutlet
    weak var openGallery: SWCustomButton!
  • Undocumented

    Declaration

    Swift

    @IBAction
    func scheduleSwitchTapped(_ sender: Any)
  • Handler for tapping the view of broadcast description and channel to be edited.

    Declaration

    Swift

    @objc
    func descriptionAndChannelViewClicked(forShow isShow: Bool)
  • Set broadcast’s description and channel to UI.

    Declaration

    Swift

    func broadcastDescriptionAndChannelSet()
  • check and dismiss preview recorder controller if present

    Declaration

    Swift

    class func checkAndDismissPreviewRecorderControllerIfPresent(successBlock:@escaping ((Bool) -> Void))

    Parameters

    successBlock

  • Start a deferred broadcast.

    Declaration

    Swift

    @IBAction
    func recordBroadcastBtnClicked(_ sender: Any)

    Parameters

    sender

    <#sender description#>

  • Undocumented

    Declaration

    Swift

    func startBroadcast(inWaitingRoom:Bool = true, isScheduledBroadcast : Bool = false, scheduleTime : Double? = nil )
  • Undocumented

    Declaration

    Swift

    func makeCreateBroadcastAPICallWith(stream: SWStream, durationInMillis: Int, videoQuality: String, bDetails: BroadcastDetails, inWaitingRoom:Bool = true, isScheduledBroadcast : Bool , scheduledTime : Double?)
  • Undocumented

    Declaration

    Swift

    func showErrorCaseWhileUploadingPreview()
  • Handler for tapping live room button.

    Declaration

    Swift

    @IBAction
    func waitingRoomBtnClicked(_ sender: Any)

    Parameters

    sender

    <#sender description#>

  • Handler for tapping live room button.

    Declaration

    Swift

    @IBAction
    func liveRoomBtnClicked(_ sender: Any)

    Parameters

    sender

    <#sender description#>

  • Undocumented

    Declaration

    Swift

    @IBAction
    func goBackBtnClicked(_ sender: Any)
  • Handler for tapping Record / Stop button.

    Declaration

    Swift

    @IBAction
    func recordBtnClicked(_ sender: Any)

    Parameters

    sender

    <#sender description#>

  • Handler to tapping rerecord button.

    Declaration

    Swift

    @IBAction
    func rerecordBtnClicked(_ sender: Any)

    Parameters

    sender

    <#sender description#>

  • Handling tapping location button. Should toggle enable / disable broadcast location.

    Declaration

    Swift

    @IBAction
    func locationBtnClicked(_ sender: UIButton?)

    Parameters

    sender

    <#sender description#>

  • Undocumented

    Declaration

    Swift

    @IBAction
    func postOnFacebookButtonTapped(_ sender: UIButton)
  • Undocumented

    Declaration

    Swift

    @IBAction
    func postOnTwitter(_ sender: UIButton)
  • Undocumented

    Declaration

    Swift

    func twitterShare()
  • Undocumented

    Declaration

    Swift

    func facebookShare()
  • Handler for tapping GO LIVE button.

    Make sure that all required permission is granted before start broadcasting. If not, it should request for microphone and camera access.

    Declaration

    Swift

    @IBAction
    func goLiveBtnClicked(_ sender: Any)

    Parameters

    sender

    sender description

  • Handler for switch between front and back camera button tap event.

    Declaration

    Swift

    @IBAction
    func switchCameraBtnClicked(_ sender: Any)

    Parameters

    sender

    sender description

  • Handler for tap event of close button.

    This should make sure to release any allocated memory.

    Declaration

    Swift

    @IBAction
    func closeBtnClicked(_ sender: Any)

    Parameters

    sender

    sender description

  • Undocumented

    Declaration

    Swift

    func dismissPreviewController(animated : Bool = true)
  • Instantiate video writer and add video input to it. AVAssetWriter could be once. Therefor, it should be reinstantiate on rerecord.

    Declaration

    Swift

    func initializeVideoWriter()
  • Returns proper Camera (AVCaptureDevice has AVMediaTypeVideo) for specified position (Front / Back) or default device if not found.

    Declaration

    Swift

    func cameraDeviceForCurrentSelectedPosition() -> AVCaptureDevice

    Parameters

    position

    <#position description#>

    Return Value

    <#return value description#>

  • Update count down label and show stop button when recording is 3 seconds or more.

    Declaration

    Swift

    @objc
    func updateRecordingProgress()
  • Switch play button back to play button state when playing reach end.

    Declaration

    Swift

    @objc
    func playerDidReachEnd()
  • Make sure that location button is disabled if location services are disabled.

    Declaration

    Swift

    @objc
    func applicationWillEnterForeground()
  • Handler for Pan event of Live or Waiting Room draggable button. Drag the button among user action and decide for proper action when button is released.

    Declaration

    Swift

    @objc
    func liveOrWaitingRoomButtonDidDragged(_ gestureRecognizer: UIPanGestureRecognizer)

    Parameters

    gestureRecognizer

    <#gestureRecognizer description#>

  • Handler for tapping Tap to connect again button.

    Declaration

    Swift

    @IBAction
    func retryBtnClicked(_ sender: Any)

    Parameters

    sender

    <#sender description#>

  • Delegate method being invoked when video and audio data output buffer receive sample buffer. This method should pass received sample buffer to asset writer input.

    Declaration

    Swift

    func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection)

    Parameters

    output

    <#output description#>

    sampleBuffer

    <#sampleBuffer description#>

    connection

    <#connection description#>