Skip to content

linkplayapp/LPMSMediaLibraryiOS

Repository files navigation

LPMSMediaLibraryiOS

English | 中文

LPMSMediaLibrary is the app side SDK for Linkplay iPhone media library access solution;you can use it to quickly play music from iPhone media library to your products.

LPMSMediaLibrary mainly provides two functions:

  • Show music in iPhone media library.

  • Play music from iPhone media library to your product.

Documentation

You can find documentation on the website.

How To Get Started

SDK Demo

1. SDK demo with CocoaPods

2. SDK demo

Requirements

  • iOS >= 10.0

Installation

1. Installationwith CocoaPods

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

platform :ios, '10.0'
# Private Spec, install data processing SDK
source 'https://github.com/linkplayapp/LPSpecsiOS.git'
# Your CocosPods repo source address
source 'https://github.com/CocoaPods/Specs.git'

target 'your_target_name' do

   pod "LPMSMediaLibraryiOS", :git => "https://github.com/linkplayapp/LPMSMediaLibraryiOS.git"

end

Then run the pod update command in the root directory of project. For use of CocoaPods, please refer to the CocoaPods Guides. It is recommended to update the CocoaPods to the latest version.

  • Info.plist add the key to access the media library: NSAppleMusicUsageDescription
  • Apply for long background permission image

2. Manually configure your project

Step 1: Download LPMSMediaLibraryiOS

Step 2: Import Framework

Step 3: Import dependent libraries

  • Import files from LPMSMediaLibraryiOS/Resource and LPMSMediaLibraryiOS/Library image

Step 4: Xcode project settings

  • Info.plist add the key to access the media library: NSAppleMusicUsageDescription
  • Apply for long background permission image

Because of the need to play local music, the LPMSMediaLibraryiOS/Library/CocoaHTTP/HTTPConnection file was modified, the HTTPConnection+iTunes class was added, and the code was also added to the GCDAsyncSocket class. If you have imported these three three-party libraries, you need to pay attention to the modification

// HTTPConnection
if ([self respondsToSelector:@selector(prepareITunesFile:)]) {
    [self prepareITunesFile:uri];
}

// GCDAsyncSocket
// - (void)doWriteData
Class class = NSClassFromString(@"LPMSLibraryManager");
...

Author

LinkPlay, ios_team@linkplay.com