Coder Social home page Coder Social logo

keith's Introduction

Keith

Build Status CocoaPods Version Carthage compatible GitHub release GitHub license

A media player for iOS written in Swift 3.0. Keith was based on the audio player implemented on https://github.com/jaredsinclair/sodes-audio-example.

Features

  • Generic audio and video player for iOS
  • Easier than setting up your own AVPlayer stack
  • No need to deal with key-value observing AVPlayer and AVPlayerItem properties yourself
  • Deals with audio session interruptions for you
  • Remote commands for Control Center

Keith does not include any UI elements. Only player logic.

Installation

Using CocoaPods:

use_frameworks!
pod 'Keith'

Using Carthage:

github "Movile/Keith"

Manually:

  1. Drag Keith.xcodeproj to your project in the Project Navigator.
  2. Select your project and then your app target. Open the Build Phases panel.
  3. Expand the Target Dependencies group, and add Keith.framework.
  4. Click on the + button at the top left of the panel and select New Copy Files Phase. Set Destination to Frameworks, and add Keith.framework.
  5. import Keith whenever you want to use Haneke.

Requirements

  • iOS 9.2+
  • Swift 3.0

Usage

To get started, first create a playback source.

let url = URL(string: "http://devstreaming.apple.com/videos/wwdc/2016/102w0bsn0ge83qfv7za/102/hls_vod_mvp.m3u8")!
let type: PlaybackSource.`Type` = .video

let source = PlaybackSource(url: url, type: type)

Then, set up the playback controller, which is Keith's working horse.

let playbackController = PlaybackController()
playbackController.prepareToPlay(source, playWhenReady: true, startTime: 0.0)

You can optionally use the playback controller's shared property to obtain a singleton instance. This may be useful when you need to retain the controller in your whole app's lifetime -- audio player app's are a common use case.

let playbackController = PlaybackController.shared

The playback controller supports standard operations (play, pause, toggle play/pause, skip forward/backward, seek) and has a status property to check for playback states.

It's possible to get the underlying AVPlayer from the playback controller and use it to include in an AVPlayerViewController, for example.

import AVKit

let playerViewController = AVPlayerViewController()
playerViewController.player = playbackController.player

Observe the following notifications to monitor changes in the playback state.

  • didBeginPlayback
  • didPausePlayback
  • didResumePlayback
  • didStopPlayback
  • willChangePositionTime
  • didChangePositionTime
  • didUpdateElapsedTime
  • didUpdateDuration
  • didUpdateStatus
  • didPlayToEnd
  • willChangePlaybackSource
  • didChangePlaybackSource

Name

Keith's name is a homage to Keith Richards, one of the greatest guitar players that ever existed and the embodiment of rock 'n roll itself.

If you've gotta think about being cool, you ain' cool

Keith Richards

keith's People

Contributors

rafael-alencar-movile avatar matheus-maaz-movile avatar kacpiii avatar

Watchers

 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.