Latest 0.7.0
Homepage https://github.com/0x0c/LMMediaPlayer
License MIT
Platforms ios 10.0, requires ARC
Frameworks UIKit, AVFoundation, MediaPlayer
Authors

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

LMMediaPlayer is a video and an audio player for iPhone with replaceable user interface.



Requirements

  • Runs on iOS 6.0 or later.

Contribution

Please use clang-format and use .clang-format file which is containing this repo.

Installation

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

pod "LMMediaPlayer"

Usage

You can play MPMediaItem and http streaming contents with fullscreen or non-fullscreen mode.

//Get shared player
LMMediaPlayerView *player = [LMMediaPlayerView sharedPlayerView];

//Create media item with URL.
LMMediaItem *item1 = [[LMMediaItem alloc] initWithInfo:@{
    LMMediaItemInfoURLKey:[NSURL URLWithString:@"video or audio url"],
    LMMediaItemInfoContentTypeKey:@(LMMediaItemContentTypeVideo)
}];

//Create media item with MPMediaItem.
MPMediaItem *mediaItem =
LMMediaItem *item2 = [[LMMediaItem alloc] initWithMetaMedia:mediaItem contentType:LMMediaItemContentTypeVideo];

//Add queue.
[player.mediaPlayer addMedia:item1];
[player.mediaPlayer addMedia:item2];

//Play it!
[player.mediaPlayer play];

without player view.

//Get shared player
LMMediaPlayer *player = [LMMediaPlayer sharedPlayer];

//Create media item with URL.
LMMediaItem *item1 = [[LMMediaItem alloc] initWithInfo:@{
    LMMediaItemInfoURLKey:[NSURL URLWithString:@"video or audio url"],
    LMMediaItemInfoContentTypeKey:@(LMMediaItemContentTypeVideo)
}];

//Create media item with MPMediaItem.
MPMediaItem *mediaItem =
LMMediaItem *item2 = [[LMMediaItem alloc] initWithMetaMedia:mediaItem contentType:LMMediaItemContentTypeVideo];

//Add queue.
[player addMedia:item1];
[player addMedia:item2];

//Play it!
[player play];

Already implemented repeat mode and shuffle mode.

LMMediaPlayerView *player = [LMMediaPlayerView sharedPlayerView];
player.mediaPlayer.repeatMode = LMMediaRepeatModeNone;
player.mediaPlayer.repeatMode = LMMediaRepeatModeAll;
player.mediaPlayer.repeatMode = LMMediaRepeatModeOne;

[player.mediaPlayer setShuffleEnabled:YES];

To change user interface, use setButtonImages: and set images with these keys.

Keys
LMMediaPlayerViewPlayButtonImageKey
LMMediaPlayerViewPlayButtonSelectedImageKey
LMMediaPlayerViewStopButtonImageKey
LMMediaPlayerViewStopButtonSelectedImageKey
LMMediaPlayerViewFullscreenButtonImageKey
LMMediaPlayerViewFullscreenButtonSelectedImageKey
LMMediaPlayerViewUnfullscreenButtonImageKey
LMMediaPlayerViewUnfullscreenButtonSelectedImageKey
LMMediaPlayerViewShuffleButtonShuffledImageKey
LMMediaPlayerViewShuffleButtonShuffledSelectedImageKey
LMMediaPlayerViewShuffleButtonUnshuffledImageKey
LMMediaPlayerViewShuffleButtonUnshuffledSelectedImageKey
LMMediaPlayerViewRepeatButtonRepeatOneImageKey
LMMediaPlayerViewRepeatButtonRepeatOneSelectedImageKey
LMMediaPlayerViewRepeatButtonRepeatAllImageKey
LMMediaPlayerViewRepeatButtonRepeatAllSelectedImageKey
LMMediaPlayerViewRepeatButtonRepeatNoneImageKey
LMMediaPlayerViewRepeatButtonRepeatNoneSelectedImageKey
LMMediaPlayerViewActionButtonImageKey

To show action button, set image with LMMediaPlayerViewActionButtonImageKey.

Use the following helper method for customising the progress bar:

[[LMMediaPlayerView sharedPlayerView] setProgressBarBorderColor:[UIColor whiteColor]
                                                    backgroundColor:[UIColor clearColor]
                                                          fillColor:[UIColor lightGrayColor]
                                                      minTrackColor:[UIColor redColor]
                                                     thumbTintColor:[UIColor whiteColor]];

Use the following helper method for customising the progress bar thumb:

[[LMMediaPlayerView sharedPlayerView] setProgressBarThumbImage:[UIImage imageNamed:@"thumb"]];

Of course, you can play video or audio in background mode and can control with control center.
If you want to play with fullscreen mode, please add "View controller-based status bar appearance" key and set value with "NO" at your Info.plist

Author

Akira Matsuda, [email protected]

License

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

Latest podspec

{
    "name": "LMMediaPlayer",
    "version": "0.7.0",
    "summary": "Video and audio player with replaceable UI component.",
    "homepage": "https://github.com/0x0c/LMMediaPlayer",
    "license": "MIT",
    "authors": {
        "Akira Matsuda": "[email protected]"
    },
    "source": {
        "git": "https://github.com/0x0c/LMMediaPlayer.git",
        "tag": "0.7.0"
    },
    "platforms": {
        "ios": "10.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*.{h,m}",
    "resources": [
        "Pod/Assets/LMMediaPlayerView.xib",
        "Pod/Assets/LMMediaPlayerView.bundle"
    ],
    "public_header_files": "Pod/Classes/**/*.h",
    "frameworks": [
        "UIKit",
        "AVFoundation",
        "MediaPlayer"
    ],
    "description": "LMMediaPlayer is a video and audio player for iPhone with changeable user interface.nn![](https://raw.github.com/0x0c/LMMediaPlayer/master/images/2.png)nn![](https://raw.github.com/0x0c/LMMediaPlayer/master/images/1.png)n![](https://raw.github.com/0x0c/LMMediaPlayer/master/images/3.png)nnRequirementsn====nn- Runs on iOS 6.0 or later.n- Must be complied with ARC.nnIntstallationn===nnFirst, please add these frameworks.nn===n  #import n  #import n===nnSecond, add files which is contained "LMMediaPlayer" folder.nnThat's it.nnIf you want to play with fullscreen mode, please add "View controller-based status bar appearance" key and set value with "NO" at your Info.plist"
}

Pin It on Pinterest

Share This