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,
|
mainVer: source.mainVer || 0,
|
||||||
patchVer: source.patchVer || 0,
|
patchVer: source.patchVer || 0,
|
||||||
requestHeaders: source.headers ? this.stringsOnlyObject(source.headers) : {},
|
requestHeaders: source.headers ? this.stringsOnlyObject(source.headers) : {},
|
||||||
|
startTime: source.startTime,
|
||||||
|
endTime: source.endTime
|
||||||
},
|
},
|
||||||
onVideoLoadStart: this._onLoadStart,
|
onVideoLoadStart: this._onLoadStart,
|
||||||
onVideoPlaybackStateChanged: this._onPlaybackStateChanged,
|
onVideoPlaybackStateChanged: this._onPlaybackStateChanged,
|
||||||
|
@ -6,6 +6,8 @@ struct VideoSource {
|
|||||||
let isAsset: Bool
|
let isAsset: Bool
|
||||||
let shouldCache: Bool
|
let shouldCache: Bool
|
||||||
let requestHeaders: Dictionary<String,Any>?
|
let requestHeaders: Dictionary<String,Any>?
|
||||||
|
let startTime: Int64?
|
||||||
|
let endTime: Int64?
|
||||||
|
|
||||||
let json: NSDictionary?
|
let json: NSDictionary?
|
||||||
|
|
||||||
@ -18,6 +20,8 @@ struct VideoSource {
|
|||||||
self.isAsset = false
|
self.isAsset = false
|
||||||
self.shouldCache = false
|
self.shouldCache = false
|
||||||
self.requestHeaders = nil
|
self.requestHeaders = nil
|
||||||
|
self.startTime = nil
|
||||||
|
self.endTime = nil
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
self.json = json
|
self.json = json
|
||||||
@ -27,5 +31,7 @@ struct VideoSource {
|
|||||||
self.isAsset = json["isAsset"] as? Bool ?? false
|
self.isAsset = json["isAsset"] as? Bool ?? false
|
||||||
self.shouldCache = json["shouldCache"] as? Bool ?? false
|
self.shouldCache = json["shouldCache"] as? Bool ?? false
|
||||||
self.requestHeaders = json["requestHeaders"] as? Dictionary<String,Any>
|
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._playerItem = playerItem
|
||||||
self._playerObserver.playerItem = self._playerItem
|
self._playerObserver.playerItem = self._playerItem
|
||||||
self.setPreferredForwardBufferDuration(self._preferredForwardBufferDuration)
|
self.setPreferredForwardBufferDuration(self._preferredForwardBufferDuration)
|
||||||
|
self.setPlaybackRange(playerItem, withVideoStart: self._source?.startTime, withVideoEnd: self._source?.endTime)
|
||||||
self.setFilter(self._filterName)
|
self.setFilter(self._filterName)
|
||||||
if let maxBitRate = self._maxBitRate {
|
if let maxBitRate = self._maxBitRate {
|
||||||
self._playerItem?.preferredPeakBitRate = Double(maxBitRate)
|
self._playerItem?.preferredPeakBitRate = Double(maxBitRate)
|
||||||
@ -533,6 +534,15 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
|
|||||||
// Fallback on earlier versions
|
// 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() {
|
func applyModifiers() {
|
||||||
|
Loading…
Reference in New Issue
Block a user