feat: implement startPosition (#3355)
* feat(android): implement startPosition * feat(ios): implement startPosition * feat: implement startPosition type * docs: fix typo * docs: update startPosition * refactor: put startPosition inside source prop - put startPosition inside source prop - rename existing prop (startTime, endTime) * docs: update startPosition property description * fix: fix invalid assignments * refactor: remove redundant optional chaining * feat: allow "0" to work too
This commit is contained in:
@@ -19,8 +19,8 @@ enum RCTVideoUtils {
|
||||
return 0
|
||||
}
|
||||
|
||||
if (source?.startTime != nil && source?.endTime != nil) {
|
||||
return NSNumber(value: (Float64(source?.endTime ?? 0) - Float64(source?.startTime ?? 0)) / 1000)
|
||||
if (source?.cropStart != nil && source?.cropEnd != nil) {
|
||||
return NSNumber(value: (Float64(source?.cropEnd ?? 0) - Float64(source?.cropStart ?? 0)) / 1000)
|
||||
}
|
||||
|
||||
var effectiveTimeRange:CMTimeRange?
|
||||
@@ -35,8 +35,8 @@ enum RCTVideoUtils {
|
||||
if let effectiveTimeRange = effectiveTimeRange {
|
||||
let playableDuration:Float64 = CMTimeGetSeconds(CMTimeRangeGetEnd(effectiveTimeRange))
|
||||
if playableDuration > 0 {
|
||||
if (source?.startTime != nil) {
|
||||
return NSNumber(value: (playableDuration - Float64(source?.startTime ?? 0) / 1000))
|
||||
if (source?.cropStart != nil) {
|
||||
return NSNumber(value: (playableDuration - Float64(source?.cropStart ?? 0) / 1000))
|
||||
}
|
||||
|
||||
return playableDuration as NSNumber
|
||||
|
Reference in New Issue
Block a user