Did you find this summary helpful?
Thank you for your feedback
Installing the code CocoaPods Podfile
Add the code below to
source 'https://github.com/CocoaPods/Specs.git'
# Match the Version with the Project's Minimum Supported Version
# Shoplive iOS SDK requires iOS 11.0 or later.
platform :ios, '11.0'
use_frameworks!
# Set the Project Target for Shoplive iOS SDK Installation
target 'ShortformProj' do
pod 'ShopliveShortformEditorSDK', '1.6.1'
pod 'ShopliveSDKCommon', '1.6.1'
end
Swift Package Manager Package Dependencies
Add the following:
dependencies: [
.package(url: "https://github.com/shoplive/shortform-ios", .exact(from: "1.6.1")),
.package(url: "https://github.com/shoplive/common-ios", .exact(from: "1.6.1"))
]
If the installation fails, clear the cache.
Run the following command in your terminal to clear the cache:
rm -rf ~/Library/Caches/org.swift.swiftpm
rm -rf ~/Library/org.swift.swiftpm
ShopLiveShortformEditorSDK has a dependency on the FFMpeg Library.
Run the following command in your terminal to clear the cache:
Add the FFMpeg SPM below or your preferred version of FFMpeg Library
dependencies: [
.package(url: "https://github.com/tylerjonesio/ffmpeg-kit-spm/", .branch(from: "main"))
]
Applying an AccessKey import ShopliveSDKCommon
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
ShopLiveCommon.setAccessKey(accessKey: "YOUR_ACCESSKEY") //required
return true
}
}
You can find your access key and secret key through your ShopLive representative.
Applying ShopLiveEditor ShopLiveMediaPicker If you want to use Editor's features with this class, you can use ShopLive's own AlbumPicker.
import ShopliveSDKCommon
import ShopLiveShortformEditorSDK
class ViewController : UIViewController {
func startMediaPicker() {
ShopLiveMediaPicker.shared
.setDelegate(self)
.setPermissionHandler(nil)
.start(self, type: .image) // type : .video
}
}
extension ViewController : ShopLiveMediaPickerDelegate {
func onShopLiveMediaPickerError(error : ShopLiveCommonError) {
}
func onShopLiveMediaPickerDidPickVideo(absoluteUrl: URL, relativeUrl: URL) {
}
func onShopLiveMediaPickerDidPickImage(imageUrl: URL) {
print("Picker Image Selected image: \(imageUrl)")
let image = UIImage(contentsOfFile: imageUrl.path)
coverPickerImageResultPopUp.setResultImage(image: image)
coverPickerImageResultPopUp.alpha = 1
ShopLiveMediaPicker.shared.close()
}
func onShopLiveMediaPickerCancelled() {
}
}
ShopLiveVideoEditor If you want to use the Editor's features with this class, you can use ShopLive's own VideoEditor.
import ShopliveSDKCommon
import ShopLiveShortformEditorSDK
class ViewController : UIViewController {
func startVideoEditor() {
let cropOption = ShopliveVideoEditorAspectRatio(width: OptionSettingModel.editorWidth,
height: OptionSettingModel.editorheight,
isFixed: OptionSettingModel.editorIsFixed)
let trimOption = ShopliveVideoEditorTrimOption(minVideoDuration: 3,
maxVideoDuration: 90)
let videoOutPutOption = ShopLiveShortformEditorVideoOuputOption(videoOutputQuality: .max,
videoOutputResoltuion: ._1080)
let visibleContents = ShopLiveShortFormEditorVisibleContent(isDescriptionVisible: OptionSettingModel.editorShowDescription,
isTagsVisible: OptionSettingModel.editorShowTags,
editOptions: [.volume])
ShopliveVideoEditor.shared
.setPermissionHandler(nil)
.setConfiguration(.init(videoCropOption: cropOption,
videoOutputOption: videoOutPutOption,
videoTrimOption: trimOption,
visibleContents: visibleContents))
.setDelegate(self)
.start(self, data: .init(videoUrl: localUrl,isCreatedShortform: true))
}
}
extension ViewController : ShopLiveVideoEditorDelegate {
func onShopLiveVideoEditorError(error : ShopLiveCommonError) {
}
func onShopLiveVideoEditorVideoConvertSuccess(videoPath : String) {
}
func onShopLiveVideoEditorUploadSuccess(shortsId : String) {
ShopLiveMediaPicker.shared.close()
}
func onShopLiveVideoEditorCancelled() {
}
}
ShopLiveCoverPicker If you want to use the Editor's features with this class, you can use ShopLive's own CoverPicker. CoverPicker allows you to change the cover photo of a short-form form you create.
import ShopliveSDKCommon
import ShopLiveShortformEditorSDK
class ViewController : UIViewController {
func startCoverPicker() {
let cropOption = ShopLiveShortFormEditorAspectRatio(width: 9,
height: 16,
isFixed: true)
let visibleActionButton = ShopLiveCoverPickerVisibleActionButton(editOptions: [.crop])
ShopLiveCoverPicker.shared
.setConfiguration(.init(cropOption: cropOption,
visibleActionButton: visibleActionButton))
.setDelegate(vc)
.start(vc, data: .init(videoUrl: videoUrl,shortsId: nil))
}
}
extension ViewController : ShopLiveCoverPickerDelegate {
func onShopLiveCoverPickerError(error : ShopLiveCommonError) {
}
func onShopLiveCoverPickerCoverImageSuccess(image : UIImage?) {
}
func onShopLiveCoverPickerUploadSuccess(shortsId : String) {
ShopLiveMediaPicker.shared.close()
}
func onShopLiveCoverPickerCancelled() {
}
}