iOS playback range
This commit is contained in:
parent
dc8c618d41
commit
7da44c238f
2
Video.js
2
Video.js
@ -342,6 +342,8 @@ export default class Video extends Component {
|
||||
mainVer: source.mainVer || 0,
|
||||
patchVer: source.patchVer || 0,
|
||||
requestHeaders: source.headers ? this.stringsOnlyObject(source.headers) : {},
|
||||
startTime: source.startTime,
|
||||
endTime: source.endTime
|
||||
},
|
||||
onVideoLoadStart: this._onLoadStart,
|
||||
onVideoPlaybackStateChanged: this._onPlaybackStateChanged,
|
||||
|
@ -6,6 +6,8 @@ struct VideoSource {
|
||||
let isAsset: Bool
|
||||
let shouldCache: Bool
|
||||
let requestHeaders: Dictionary<String,Any>?
|
||||
let startTime: Int64?
|
||||
let endTime: Int64?
|
||||
|
||||
let json: NSDictionary?
|
||||
|
||||
@ -18,6 +20,8 @@ struct VideoSource {
|
||||
self.isAsset = false
|
||||
self.shouldCache = false
|
||||
self.requestHeaders = nil
|
||||
self.startTime = nil
|
||||
self.endTime = nil
|
||||
return
|
||||
}
|
||||
self.json = json
|
||||
@ -27,5 +31,7 @@ struct VideoSource {
|
||||
self.isAsset = json["isAsset"] as? Bool ?? false
|
||||
self.shouldCache = json["shouldCache"] as? Bool ?? false
|
||||
self.requestHeaders = json["requestHeaders"] as? Dictionary<String,Any>
|
||||
self.startTime = json["startTime"] as? Int64
|
||||
self.endTime = json["endTime"] as? Int64
|
||||
}
|
||||
}
|
||||
|
@ -292,6 +292,7 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
|
||||
self._playerItem = playerItem
|
||||
self._playerObserver.playerItem = self._playerItem
|
||||
self.setPreferredForwardBufferDuration(self._preferredForwardBufferDuration)
|
||||
self.setPlaybackRange(playerItem, withVideoStart: self._source?.startTime, withVideoEnd: self._source?.endTime)
|
||||
self.setFilter(self._filterName)
|
||||
if let maxBitRate = self._maxBitRate {
|
||||
self._playerItem?.preferredPeakBitRate = Double(maxBitRate)
|
||||
@ -533,6 +534,15 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
|
||||
// Fallback on earlier versions
|
||||
}
|
||||
}
|
||||
|
||||
func setPlaybackRange(_ item:AVPlayerItem!, withVideoStart videoStart:Int64?, withVideoEnd videoEnd:Int64?) {
|
||||
if (videoStart != nil) {
|
||||
item.reversePlaybackEndTime = CMTimeMake(value: videoStart!, timescale: 1000)
|
||||
}
|
||||
if (videoEnd != nil) {
|
||||
item.forwardPlaybackEndTime = CMTimeMake(value: videoEnd!, timescale: 1000)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func applyModifiers() {
|
||||
|
Loading…
Reference in New Issue
Block a user