UNPKG

unified-video-framework

Version:

Cross-platform video player framework supporting iOS, Android, Web, Smart TVs (Samsung/LG), Roku, and more

85 lines (67 loc) 2.24 kB
# UnifiedVideoPlayer (iOS SDK) A unified iOS video player SDK with: - HLS playback (AVPlayer) - FairPlay DRM (SPC/CKC) - Subtitles/audio track selection (AVMediaSelection) - Picture-in-Picture (AVPictureInPictureController) - AirPlay (AVRoutePickerView) - Remote Command Center + Now Playing (lock screen controls) - Background audio (AVAudioSession) ## Installation ### CocoaPods 1) Ensure this SDK is in a public Git repository. Update the podspec `s.source` to point at that repo and tag. 2) In your Podfile: ```ruby platform :ios, '13.0' use_frameworks! target 'YourApp' do pod 'UnifiedVideoPlayer', :git => 'https://github.com/yourcompany/unified-video-ios.git', :tag => '1.0.0' end ``` 3) Run: ```bash pod install ``` ### Swift Package Manager Add the package at the repository URL or use Add Local Package pointing to `packages/ios`. ## Quick Start ```swift import UnifiedVideoPlayer let containerView = UIView(frame: .zero) let player = UnifiedVideoPlayer() let config = PlayerConfiguration() config.autoPlay = true player.initialize(container: containerView, configuration: config) let source = MediaSource(url: "https://example.com/stream.m3u8") source.metadata = ["title": "Demo Stream"] player.onReady = { print("ready") } player.onQualityChange = { br in print("bitrate: \(br)") } player.load(source: source) ``` ### FairPlay DRM ```swift let drm = DRMConfiguration(type: "fairplay", licenseUrl: "https://license.example.com/fps") drm.certificateUrl = "https://license.example.com/cert" drm.headers = ["X-Tenant-ID": "default"] let source = MediaSource(url: "https://cdn.example.com/protected/playlist.m3u8") source.drm = drm player.load(source: source) ``` ### Tracks ```swift let audios = player.audioTracks() // [String] let subs = player.subtitleTracks() // [String] player.selectAudioTrack(index: 0) player.selectSubtitleTrack(index: -1) // off ``` ### PiP & AirPlay ```swift player.startPictureInPicture() player.stopPictureInPicture() let airPlay = player.makeAirPlayPickerView() ``` ## Capabilities - Enable Background Modes > Audio - For DRM endpoints, configure ATS exceptions if necessary. ## License MIT