Code Monkey home page Code Monkey logo

dvplaylistplayer's Introduction

DVPlaylistPlayer

DVPlaylistPlayer is an easy-to-use AVQueuePlayer-like player with wider capabilities. It is built on top of the AVPlayer. Unlike AVQueuePlayer here you have all the basic player controls like moving to next or previous video, mute, unmute or change volume level and so on. Another difference with AVQueuePlayer is in non-regular way of setting the list of tracks. This player takes it's tracks from data source like UITableView. Detailed implementation and usage information provided in our blog - http://blog.denivip.ru/index.php/2013/07/playlist-player-for-ios/?lang=en

##Required frameworks##

  • MediaPlayer
  • AVFoundation
  • AudioToolbox

##Adding DVPlaylistPlayer to your project## ###CocoaPods### The easiest way to add our playlist player to your project is to use CocoaPods. If you don't have CocoaPods installed on your system, then we suggest you to check cocoapods.org for further information. All you need to do to install DVPlaylistPlayer is to create file named 'Podfile' right in your project.xcodeproj file directory. Then you need to add next two lines:

platform :ios, '5.0' //depends on your project requirments but not less pod 'DVPlaylistPlayer', :git=>'https://github.com/denivip/DVPlaylistPlayer'

Then you enter magic words to your console: pod install

and DVPlaylistPlayer will be automatically downloaded and installed to your project. All the frameworks required for player will also be added automatically. Just don't forget to use Workspace file instead of *.xcodeproj from now!

###Source files### The other way is to add source files to your project directly by copying them. Here is the algorithm.

  • Clone this repository or download zip archive with SDK.
  • Open your project in XCode and drag-and-drop all files from directory 'DVPlaylistPlayer' to your project.
  • import class DVPlaylistPlayer.h to any implementation or header file where you want to use it.

##Usage## DVPlaylistPlayer is really easy to use. All you need to start playing media is to create an instance:

self.playlistPlayer = [[DVPlaylistPlayer alloc] init];

Provide it with the data source:

self.playlistPlayer.dataSource = some id<DVPlaylistPlayerDataSource>;

And play:

[self.playlistPlayer playMediaWithIndex:0];

That is all. Data source takes AVPlayerItem files in it's method and passes it to player. DVPlaylistPlayer does all the player setup for you. Playlist player have all the regular player controls as methods. Here's the list.

  • playMediaWithIndex:
  • resume
  • pause
  • stop
  • next
  • previous
  • setVolume
  • mute
  • unmute

Additionally you can receive events about playing state changes and set a periodic time observer. To receive events you just have to set the 'delegate' property on player. Delegate object must correspond to protocol DVPlaylistPlayerDelegate. To set a periodic time observer you must call method addPeriodicTimeObserverForInterval:queue:usingBlock:. Also if you need to have an access to the AVPlayer instance that is lying at the heart of DVPlaylistPlayer - you're welcome. It is in public interface.

##Requirements## DVPlaylistPlayer requires iOS 5.0 as minimum OS version. This project uses ARC.

dvplaylistplayer's People

Contributors

kolyuchiy avatar zapsleep avatar

Watchers

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