Giter Site home page Giter Site logo

pantomime's Introduction

Pantomime

Pantomime is a lightweight framework for iOS, OSX and tvOS that can read and parse HTTP Live Streaming manifests.

Latest build

Build Status

Installation

You can use Carthage to install Pantomime by adding that to your Cartfile:

github "thomaschristensen/Pantomime"

via CocoaPods

To use CocoaPods just add this to your Podfile:

pod 'Pantomime'

via Swift Package Manager

To use Pantomime as a Swift Package Manager package just add the following in your Package.swift file.

import PackageDescription

let package = Package(
    name: "HelloWorld",
        dependencies: [
            .Package(url: "https://github.com/thomaschristensen/Pantomime", majorVersion: 0)
        ]
    )

Usage

To use the parser just do the following:

import Pantomime

let builder = ManifestBuilder()
if let url = NSURL(string: "http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8") {
    let manifest = builder.parse(url)
}

The ManifestBuilder's parse method expects a master playlist manifest to be found at the other end of the URL. Once this has been parsed all Media Playlist Manifests referred to in the master will also be fetched and parsed.

Core Classes

ManifestBuilder

The manifest builder can parse both Master and Media playlist manifests. You can choose to let ManifestBuilder parse master and it's media playlists, or you can parse either the master or media playlists only.

MasterPlaylist

Represents a master playlist and it holds a reference to a list of media playlist objects

MediaPlaylist

The media playlist object contains a list of all video segments and other properties like target duration (max duration of each segment), path, version, bandwidth, program-id and the starting media sequence number.

MediaSegment

This object holds a reference to the actual video file (path), it's actual duration, sequence number and optional title.

Helper Classes

BufferedReader

This is a protocol that defines how these text manifest documents can be read line by line. Various implementations of this protocol exist helping reading the documents from a File, a URL or from a String. These implementations are FileBufferedReader, URLBufferedReader and StringBufferedReader.

ReaderBuilder

Is a utility class that can be used to construct the actual implementation of BufferedReader by specifying which type is required. (This class is already deprecated. Use the implementations of BufferedReader directly)

NSURLExtension

An extension to the NSURL class has been made to assist in constructing the right URL when given relative paths in the various manifest files.

let masterManifest = "http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8"
let mediaManifest = "gear1/prog_index.m3u8"

if let masterManifestURL = NSURL(string: masterManifest) {
    let mediaManifestURL = masterManifestURL.URLByReplacingLastPathComponent(mediaManifest)
    // mediaManifestURL now = http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8
}

License

The Pantomime Framework is released under the MIT License.

Todo

  • Construct Master and Media Playlist objects and write them as files

pantomime's People

Contributors

pwoods-al avatar thomaschristensen avatar uthiel avatar bill-niz avatar ruipfcosta 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.