Latest 0.1.3
Homepage https://github.com/oleghnidets/OHSubtitlePlayer
License MIT
Platforms ios 8.0, requires ARC
Frameworks AVKit, AVFoundation, UIKit, Foundation
Authors

The wrapper supports local subtitles .srt and .vtt. AVPlayer doesn’t provide interface for such feature (only built-in subtitles). Also AVPlayerViewController is expected for using in fullscreen mode. But you can use this wrapper for playing a video in windowed mode (with/without subtitles).

alt tag

Installation

Using Podfile:

pod 'OHSubtitlePlayer'

Or just copy files into your project.

Usage

OHSubtitlePlayer can be configured via code or storyboard/xib. My recommendation is using via storyboards/xib. It’s a bit faster and clear.
You need drag a component ‘Object’, set the class OHSubtitlePlayer, connect outlets and configure property using ‘Attributes inspector’.

alt tag

alt tag

Following lines load subtitles.

NSString *movieFilePath = [[NSBundle mainBundle] pathForResource:@"video.mp4" ofType:nil];
[self.subtitlePlayer loadViewControllerComponentsWithURL:[NSURL fileURLWithPath:movieFilePath] showSubtitleView:YES];
[self.subtitlePlayer loadSubtitleWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"example.vtt" ofType:nil]];

License

The MIT License (MIT)

Latest podspec

{
    "name": "OHSubtitlePlayer",
    "version": "0.1.3",
    "summary": "Wrapper for AVPlayerViewController with supporting local subtitles.",
    "description": "The wrapper supports local subtitles .srt and .vtt. AVPlayer doesn't provide interface for such feature (only built-in subtitles). Also AVPlayerViewController is expected for using in fullscreen mode. But you can use this wrapper for playing a video in windowed mode (with/without subtitles).",
    "homepage": "https://github.com/oleghnidets/OHSubtitlePlayer",
    "license": "MIT",
    "authors": {
        "Oleg": "[email protected]"
    },
    "source": {
        "git": "https://github.com/oleghnidets/OHSubtitlePlayer.git",
        "tag": "0.1.3"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "SubtitlePlayer/*.{h,m}",
    "resources": [
        "SubtitlePlayer/*.xib"
    ],
    "frameworks": [
        "AVKit",
        "AVFoundation",
        "UIKit",
        "Foundation"
    ]
}

Pin It on Pinterest

Share This