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.
You can find documentation on the website.
- Download LPMSMediaLibraryiOS and import SDK to your project
- iOS >= 10.0
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
- Import LPMSMediaLibrary.framework, and its dependent SDK: LPMusicKitiOS、LPMDPKitiOS
- Info.plist add the key to access the media library: NSAppleMusicUsageDescription
- Apply for long background permission
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");
...
LinkPlay, ios_team@linkplay.com