Giter Site home page Giter Site logo

samad5353 / aspvideoplayer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from andreipitis/aspvideoplayer

0.0 1.0 0.0 24.48 MB

A simple video player that allow animations to be performed on the view during playback.

License: MIT License

Swift 99.86% Objective-C 0.14%

aspvideoplayer's Introduction

ASPVideoPlayer

CI Status codebeat badge codecov Version License Platform

Example

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

Usage

There are two objects you can use to display a video:

  1. ASPVideoPlayer
  2. ASPVideoPlayerView

1. ASPVideoPlayer

aspvideoplayer

ASPVideoPlayer is a full video player with UI controls.

You should use this if you just want to display videos in a player with controls such as play, pause, scrub, next, previous.

  • You can instantiate the object from code:
let videoPlayer = ASPVideoPlayer()
  • You can also instantiate it from Interface Builder and create an IBOutlet:
@IBOutlet weak var videoPlayer: ASPVideoPlayer!
  • Once you have the reference, you can set the video URLs, the gravity and wether the videos should loop:
let firstVideoURL = Bundle.main.url(forResource: "video", withExtension: "mp4")
let secondVideoURL = Bundle.main.url(forResource: "video2", withExtension: "mp4")

videoPlayer.videoURLs = [firstVideoURL!, secondVideoURL!]

videoPlayer.gravity = .aspectFit

videoPlayer.shouldLoop = true

2. ASPVideoPlayerView

ASPVideoPlayerView is a component that ASPVideoPlayer uses to display the video, but you can also use it by itself.

It's a simple UIView with no UI elements.

If you wish to implement your own video player, or want a simple component to display a single video with no other UI elements, you should use this.

  • You can instantiate the object from code:
let videoPlayer = ASPVideoPlayerView()
  • You can also instantiate it from Interface Builder and create an IBOutlet:
@IBOutlet weak var videoPlayer: ASPVideoPlayerView!
  • Once you have the reference, you can set a video url and use the closures to handle different events:
let videoURL = Bundle.main.url(forResource: "video", withExtension: "mp4")

videoPlayer.videoURL = videoURL

videoPlayer.readyToPlayVideo = {
  print("Video has been successfully loaded and can be played.")
}
    
videoPlayer.startedVideo = {
  print("Video has started playing.")			
}

Installation

ASPVideoPlayer is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "ASPVideoPlayer"

Author

Andrei-Sergiu Pitis, [email protected]

License

ASPVideoPlayer is available under the MIT license. See the LICENSE file for more info.

aspvideoplayer's People

Watchers

Abdul Samad avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.