GithubHelp home page GithubHelp logo

bluemix / avplayerviewcontroller-subtitles Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mhergon/avplayerviewcontroller-subtitles

0.0 1.0 0.0 17.33 MB

Easy way to show SRT files on AVPlayerViewController

License: Apache License 2.0

Ruby 5.28% Swift 94.72%

avplayerviewcontroller-subtitles's Introduction

Logo

issues โ€ƒ stars โ€ƒ license

AVPlayerViewController-Subtitles is a library to display subtitles on iOS. It's built as a Swift extension and it's very easy to integrate.

How To Get Started

Installation with CocoaPods

platform :ios, '8.0'
pod "AVPlayerViewController-Subtitles"

Manually installation

Download (right-click) and add to your project.

Requirements

Version Language Minimum iOS Target
1.x Swift iOS 8

Usage

import AVPlayerViewControllerSubtitles
// Video file
let videoFile = NSBundle.mainBundle().pathForResource("trailer_720p", ofType: "mov")

// Subtitle file
let subtitleFile = NSBundle.mainBundle().pathForResource("trailer_720p", ofType: "srt")
let subtitleURL = NSURL(fileURLWithPath: subtitleFile!)

// Movie player
let moviePlayer = AVPlayerViewController()
moviePlayer.player = AVPlayer(URL: NSURL(fileURLWithPath: videoFile!))
presentViewController(moviePlayer, animated: true, completion: nil)

// Add subtitles
moviePlayer.addSubtitles().open(file: subtitleURL)
moviePlayer.addSubtitles().open(file: subtitleURL, encoding: NSUTF8StringEncoding) // optional

// Change text properties (optional)
moviePlayer.subtitleLabel?.textColor = UIColor.redColor()

// Play
moviePlayer.player?.play()

Screenshot

Screenshoot

Contact

License

Licensed under Apache License v2.0.
Copyright 2015-2016 Marc Hervera.

avplayerviewcontroller-subtitles's People

Contributors

mhergon 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.