• This repository has been archived on 15/Oct/2020
  • Stars
    star
    181
  • Rank 205,801 (Top 5 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created about 10 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A video and audio player with replaceable UI component.

LMMediaPlayer

[![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.

More Repositories

1

RDImageViewerController

Simple viewer not only image but also custom view.
Swift
50
star
2

M2DWebViewController

Simple built-in web view controller using WebKit.
Objective-C
25
star
3

thesislint

.texファイルに記述された文章の表現をチェックする
Go
24
star
4

AeonNodeEditor

C++
23
star
5

TableViewContent

Declare tableView row and section header/footer easy way.
Swift
23
star
6

FacebookMessengerActivity

Share with Facebook Messenger App.
Objective-C
15
star
7

AppleDevToys

A Swiss Army knife for iOS and macOS.
Swift
13
star
8

M2DHudView

Simple Hud libaray
Objective-C
13
star
9

M2DPushNotificationManager

Get device token and send to your server.
Objective-C
8
star
10

StaticPublished

StaticPublished is Swift Macro to avoid boilerplate codes that observe changes of static variables.
Swift
7
star
11

Maikai-iOS

4chan viewer
Objective-C
7
star
12

M2DRibbonView

A ribbon shape view.
Objective-C
7
star
13

CutomImagePickerController

can tap-focus with showCameraControls disable
Objective-C
6
star
14

asio_image_viewer

boost.Asio+OpenCVを使ってTCP経由で画像を送るサンプル
C++
4
star
15

musin

無心になって見ることのできるアニメ一覧
4
star
16

MIDIBLE

MIDI over BLE interface for esp-idf.
C++
4
star
17

savanna

boost-beast wrapper
C++
4
star
18

PemPem

Generate .pem file for APNS.
Objective-C
4
star
19

OSCGateway

Type-safe networking abstraction layer for Open Sound Control.
Swift
4
star
20

AeonKit

Objective-C
3
star
21

EmoT

EmoT is Emotional Wear.
Objective-C
3
star
22

NuSurface

C++
3
star
23

thunderclap

Fuck'n simple notification system.
C++
2
star
24

ofxHierarchy

C++
2
star
25

AmbientPixel

AmbientPixel a.k.a SmartPixel
Eagle
2
star
26

HC-SR04

Sample code for Arduino to use the ultrasonic sensor, HC-SR04.
Arduino
2
star
27

M2DAPIGatekeeper

Simple API networking framework
Objective-C
2
star
28

InspectionDevicesContainer

検証用端末をきちんとしまっとくための引き出し
2
star
29

value_bag

Put a value into the bag and take it functionally.
C++
2
star
30

CollectionComposer

Swift
2
star
31

AsyncImageLoader

Ruby
2
star
32

SingingCobweb

Singing Cobweb 唄う蜘蛛の巣
Processing
2
star
33

M2DSegmentedControl

You can show a badge in UISegmentedControl.
Objective-C
2
star
34

priority_parallel_queue

C++
2
star
35

AeonKit_iOS

Objective-C
2
star
36

CLLocationManager-blocks

CLLocationManager with blocks
Objective-C
2
star
37

0x0c.github.com

www.0x0c.me
SCSS
1
star
38

AeonUI

UI library for Arduino using U8glib.
C++
1
star
39

ESPSG

C++
1
star
40

packet_to_image

click modular routerでパケットを画像化する
C++
1
star
41

esp-pallarel_lines

C++
1
star
42

spd

sequential pattern detector
C++
1
star
43

esp-thunderclap

C++
1
star
44

FreeRTOS-cpp_task

C++
1
star
45

ESP32_AQM1248A

C++
1
star
46

ipn

Inter-Process Notification
C++
1
star
47

ESP32_StreamLogger

A logger using stream for esp-idf.
C++
1
star
48

Commando

Send string using UDP.
C++
1
star
49

ESP32_SPIWrapper

C++
1
star
50

EmoT_eye

C++
1
star
51

WS2812-Utility

C++
1
star
52

UIAlertView-Blocks

UIAlertView blocks extension
Objective-C
1
star
53

VIPERPractice

Swift
1
star
54

mini_synth

C++
1
star
55

CompositionalLayoutViewControllerViperExtension

Swift
1
star
56

Anagoduino

チンアナゴロボのプログラムとデザイン
Arduino
1
star
57

PopInJump

Simple Bridge library between ObjC and JavaScript
Objective-C
1
star
58

nrskb_rev_1

no right shift keyboard
1
star
59

MIDICode

A utility library to use MIDI note easily.
C++
1
star
60

ESP32_SPIWrapper_example

C++
1
star
61

m3d

C
1
star
62

TabSearch

Safari extension to search an opening tab.
JavaScript
1
star
63

parallel_lines

Fuck'n simple dispatcher.
C++
1
star
64

ktnhtmg

その時々の素直な心情を包み隠さず、juliusの音声認識用文法ファイルを例文ファイルから自動で生成する。
Python
1
star
65

jinsei_de_kutta_naka_de_ichiban_umai_XX

人生で食った中で一番美味い何か
1
star
66

timespiece

timespiece, a watchdog timer
C++
1
star
67

m3d13

Tiny 3DCG library.
C++
1
star
68

Konashi-MultiNode

この機能は公式SDKにmergeされました
Objective-C
1
star
69

LightCoordinator

1
star
70

SenchaApp

https://www.senchado.jp のお茶を入れる時に使うタイマー
Swift
1
star
71

CollectionComposerVIPERExtension

Swift
1
star
72

AspectS

1
star
73

0x0c

1
star
74

OpenDataMap

オープンデータをデータを地図上に表示するプログラムです。
Objective-C
1
star