Giter Site home page Giter Site logo

dzvideoplayerviewcontroller's Introduction

DZVideoPlayerViewController

[![CI Status](http://img.shields.io/travis/Denis Zamataev/DZVideoPlayerViewController.svg?style=flat)](https://travis-ci.org/Denis Zamataev/DZVideoPlayerViewController) Version License Platform

##What is it

iOS Video Player control, implemented with AVPlayer.

##Screenshots

image

image image image

##About

iOS Video Player control that features

  • play online or offline videos
  • playback controls: play, pause, toggle fullscreen, current time and left time labels
  • progress indicator that shows downloaded amount and allows the user to rewind
  • remote command center support
  • remote control (headset) support
  • background playback
  • now playing info updates
  • easy customization with Interface Builder
  • has several styles to choose from
  • default style is similiar to MPMoviePlayerViewController

Usage

This pod contains an Example project showing how to play local file and implement fullscreen expand and shrink transitioning.

You can find more example usage of this control here at OhMyTube github page.

Basic snippet to start with:

    self.videoPlayerViewController.delegate = self;
    self.videoPlayerViewController.videoURL = [NSURL URLWithString:@"http://distilleryvesper7-3.ak.instagram.com/fdc51d8ea73611e3a15612e740d32ce3_101.mp4"];
    self.videoPlayerViewController.isBackgroundPlaybackEnabled = YES;
    [self.videoPlayerViewController prepareAndPlayAutomatically:YES];

Implement DZVideoPlayerViewControllerDelegate

#pragma mark - <DZVideoPlayerViewControllerDelegate>

- (void)playerFailedToLoadAssetWithError:(NSError *)error {

}

- (void)playerDidPlay {
    
}

- (void)playerDidPause {
    
}

- (void)playerDidStop {
    
}

- (void)playerDidToggleFullscreen {
    if (self.videoPlayerViewController.isFullscreen) {
        // TODO: implement expand videoPlayerViewController to fullscreen
    }
    else {
        // TODO: implement shrink videoPlayerViewController from fullscreen
    }
}

- (void)playerDidPlayToEndTime {
    
}

- (void)playerFailedToPlayToEndTime {
    
}

- (void)playerPlaybackStalled {
    
}

- (void)playerGatherNowPlayingInfo:(NSMutableDictionary *)nowPlayingInfo {
//    [nowPlayingInfo setObject:self.video.author forKey:MPMediaItemPropertyArtist];
    [nowPlayingInfo setObject:self.video.title forKey:MPMediaItemPropertyTitle];
}

Requirements

Version 0.2.* and above runs on iOS 8.0 and later. Version 0.1.* runs on iOS 7.0 and later.

Customization

There are at least 3 ways to customize this control.

  1. Create custom XIB and hook up the Outlets as they appear in default XIB (DZVideoPlayerViewController.xib). No need to hook actions, because they will be added programmatically in the DZVideoPlayerViewController class.
  2. Subclass DZVideoPlayerViewController and provide your overrides for different methods.
  3. Manipulate views by their public properties. Set images for playButton and pauseButton, change tint color on progressIndicator, hide fullscreenExpandButton and fullscreenShrinkButton if you don't want that feature.

Feel free to provide Pull Requests with custom XIBs you create. Good luck!

Installation

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

pod "DZVideoPlayerViewController"

Similar Controls

Author

Denis Zamataev, [email protected]

License

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


follow button

endorse

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.