Skip to content

View to show recording video segments as Instagram, TikTok, etc

License

Notifications You must be signed in to change notification settings

asam139/SSegmentRecordingView

Repository files navigation

SSegmentRecordingView

CI Status codecov Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

SSegmentRecordingViewGif

// Set initials segments
segmentRecordingView.setInitialSegments(durations: [1.0])

// Start new segment
var duration: TimeInterval = 0.0
segmentRecordingView.startNewSegment()
var timer = Timer.scheduledTimer(withTimeInterval: 0.1, repeats: true) { timer in
    duration += 0.1
    self.segmentRecordingView.updateSegment(duration: duration)
}
timer.fire()

// Remove current segment
DispatchQueue.main.asyncAfter(wallDeadline: .now() + 1.0) {
    timer.invalidate()
    self.segmentRecordingView.removeSegment()
}

// Start new segment
DispatchQueue.main.asyncAfter(wallDeadline: .now() + 2.0) {
    self.segmentRecordingView.startNewSegment()
    duration = 0
    timer = Timer.scheduledTimer(withTimeInterval: 0.1, repeats: true) { timer in
        duration += 0.1
        self.segmentRecordingView.updateSegment(duration: duration)
    }
}

// Close current segment
DispatchQueue.main.asyncAfter(wallDeadline: .now() + 5) {
    timer.invalidate()
    self.segmentRecordingView.closeSegment()
}

Installation

Cocoapods

  1. Add this line to your project's Podfile (for Swift 5.0)
pod 'SSegmentRecordingView'

  1. Install the pod
$ pod install

Swift Package Manager (available Xcode 11.2 and forward)

  1. In Xcode, select File > Swift Packages > Add Package Dependency.
  2. Follow the prompts using the URL for this repository.

Contributions

If you have an idea for a new SSegmentRecordingView feature/functionality and want to add it to this repository, feel free to fork the project and create a pull request!

Also, feel free to create an issue if you have any suggestions or need any help ☺️

License

SSegmentRecordingView Framework

Copyright 2020 Saúl Moreno Abril, [email protected]

SSegmentRecordingView is licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

View to show recording video segments as Instagram, TikTok, etc

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published