react-native-video-trim 7.0.1 → 7.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +67 -9
- package/android/src/main/java/com/videotrim/utils/VideoTrimmerUtil.kt +1 -1
- package/android/src/main/java/com/videotrim/widgets/AudioWaveformView.kt +92 -0
- package/android/src/main/java/com/videotrim/widgets/CropOverlayView.kt +10 -24
- package/android/src/main/java/com/videotrim/widgets/VideoTrimmerView.kt +606 -32
- package/ios/AudioWaveformView.swift +75 -0
- package/ios/CropOverlayView.swift +7 -11
- package/ios/VideoTrim.mm +30 -0
- package/ios/VideoTrim.swift +7 -4
- package/ios/VideoTrimmer.swift +322 -12
- package/ios/VideoTrimmerViewController.swift +114 -44
- package/lib/module/NativeVideoTrim.js.map +1 -1
- package/lib/module/index.js +16 -4
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/NativeVideoTrim.d.ts +15 -0
- package/lib/typescript/src/NativeVideoTrim.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +3 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/NativeVideoTrim.ts +15 -0
- package/src/index.tsx +35 -4
|
@@ -49,9 +49,16 @@ class VideoTrimmerViewController: UIViewController {
|
|
|
49
49
|
private var enableHapticFeedback = true
|
|
50
50
|
private var zoomOnWaitingDuration: Double = 5.0 // Default: 5 seconds
|
|
51
51
|
|
|
52
|
-
// New color properties
|
|
53
52
|
private var trimmerColor: UIColor = UIColor.systemYellow
|
|
54
53
|
private var handleIconColor: UIColor = UIColor.black
|
|
54
|
+
private var isLightTheme = false
|
|
55
|
+
private var waveformBarColor: UIColor = .white
|
|
56
|
+
private var waveformBgColor: UIColor = UIColor(red: 0.204, green: 0.471, blue: 0.965, alpha: 1)
|
|
57
|
+
private var waveformBarWidth: CGFloat = 3
|
|
58
|
+
private var waveformBarGap: CGFloat = 2
|
|
59
|
+
private var waveformBarCornerRadius: CGFloat = 1.5
|
|
60
|
+
private var iconColor: UIColor { isLightTheme ? .black : .white }
|
|
61
|
+
private var dimmedIconColor: UIColor { iconColor.withAlphaComponent(0.5) }
|
|
55
62
|
|
|
56
63
|
private let playerController = AVPlayerViewController()
|
|
57
64
|
private var trimmer: VideoTrimmer!
|
|
@@ -212,6 +219,14 @@ class VideoTrimmerViewController: UIViewController {
|
|
|
212
219
|
setupView()
|
|
213
220
|
setupButtons()
|
|
214
221
|
setupTimeLabels()
|
|
222
|
+
|
|
223
|
+
NotificationCenter.default.addObserver(self, selector: #selector(appWillResignActive), name: UIApplication.willResignActiveNotification, object: nil)
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
@objc private func appWillResignActive() {
|
|
227
|
+
guard asset != nil else { return }
|
|
228
|
+
player.pause()
|
|
229
|
+
setPlayBtnIcon()
|
|
215
230
|
}
|
|
216
231
|
|
|
217
232
|
override func viewWillDisappear(_ animated: Bool) {
|
|
@@ -228,11 +243,16 @@ class VideoTrimmerViewController: UIViewController {
|
|
|
228
243
|
player.removeTimeObserver(token)
|
|
229
244
|
timeObserverToken = nil
|
|
230
245
|
}
|
|
231
|
-
// Remove observer
|
|
232
246
|
NotificationCenter.default.removeObserver(self, name: .AVPlayerItemDidPlayToEndTime, object: player.currentItem)
|
|
247
|
+
NotificationCenter.default.removeObserver(self, name: UIApplication.willResignActiveNotification, object: nil)
|
|
233
248
|
|
|
234
249
|
playerController.player = nil
|
|
235
250
|
playerController.dismiss(animated: false, completion: nil)
|
|
251
|
+
|
|
252
|
+
// Setting asset to nil triggers VideoTrimmer.asset.didSet, which
|
|
253
|
+
// cancels all in-flight work (thumbnail generation, waveform reader,
|
|
254
|
+
// audio download) and deletes temporary files.
|
|
255
|
+
trimmer?.asset = nil
|
|
236
256
|
}
|
|
237
257
|
|
|
238
258
|
public func pausePlayer() {
|
|
@@ -276,8 +296,8 @@ class VideoTrimmerViewController: UIViewController {
|
|
|
276
296
|
|
|
277
297
|
// MARK: - Setup Methods
|
|
278
298
|
private func setupView() {
|
|
279
|
-
self.overrideUserInterfaceStyle = .dark
|
|
280
|
-
view.backgroundColor =
|
|
299
|
+
self.overrideUserInterfaceStyle = isLightTheme ? .light : .dark
|
|
300
|
+
view.backgroundColor = isLightTheme ? .white : .black
|
|
281
301
|
|
|
282
302
|
if let headerText = headerText {
|
|
283
303
|
headerView = UIView()
|
|
@@ -326,8 +346,8 @@ class VideoTrimmerViewController: UIViewController {
|
|
|
326
346
|
}
|
|
327
347
|
|
|
328
348
|
private func setupButtons() {
|
|
329
|
-
cancelBtn = UIButton.createButton(title: cancelButtonText, font: .systemFont(ofSize: 18), titleColor:
|
|
330
|
-
playBtn = UIButton.createButton(image: playIcon, tintColor:
|
|
349
|
+
cancelBtn = UIButton.createButton(title: cancelButtonText, font: .systemFont(ofSize: 18), titleColor: iconColor, target: self, action: #selector(onCancelBtnClicked))
|
|
350
|
+
playBtn = UIButton.createButton(image: playIcon, tintColor: iconColor, target: self, action: #selector(togglePlay(sender:)))
|
|
331
351
|
playBtn.alpha = 0
|
|
332
352
|
playBtn.isEnabled = false
|
|
333
353
|
|
|
@@ -354,11 +374,12 @@ class VideoTrimmerViewController: UIViewController {
|
|
|
354
374
|
}
|
|
355
375
|
|
|
356
376
|
private func setupTimeLabels() {
|
|
357
|
-
|
|
377
|
+
let labelColor = isLightTheme ? UIColor.black : UIColor.white
|
|
378
|
+
leadingTrimLabel = UILabel.createLabel(textAlignment: .left, textColor: labelColor)
|
|
358
379
|
leadingTrimLabel.text = "00:00.000"
|
|
359
|
-
currentTimeLabel = UILabel.createLabel(textAlignment: .center, textColor:
|
|
380
|
+
currentTimeLabel = UILabel.createLabel(textAlignment: .center, textColor: labelColor)
|
|
360
381
|
currentTimeLabel.text = "00:00.000"
|
|
361
|
-
trailingTrimLabel = UILabel.createLabel(textAlignment: .right, textColor:
|
|
382
|
+
trailingTrimLabel = UILabel.createLabel(textAlignment: .right, textColor: labelColor)
|
|
362
383
|
trailingTrimLabel.text = "00:00.000"
|
|
363
384
|
|
|
364
385
|
timingStackView = UIStackView(arrangedSubviews: [leadingTrimLabel, currentTimeLabel, trailingTrimLabel])
|
|
@@ -377,6 +398,13 @@ class VideoTrimmerViewController: UIViewController {
|
|
|
377
398
|
|
|
378
399
|
private func setupVideoTrimmer() {
|
|
379
400
|
trimmer = VideoTrimmer()
|
|
401
|
+
trimmer.isLightTheme = isLightTheme
|
|
402
|
+
trimmer.waveformBarColor = waveformBarColor
|
|
403
|
+
trimmer.waveformBgColor = waveformBgColor
|
|
404
|
+
trimmer.waveformBarWidth = waveformBarWidth
|
|
405
|
+
trimmer.waveformBarGap = waveformBarGap
|
|
406
|
+
trimmer.waveformBarCornerRadius = waveformBarCornerRadius
|
|
407
|
+
trimmer.isAudioOnly = !isVideoType
|
|
380
408
|
trimmer.asset = asset
|
|
381
409
|
trimmer.minimumDuration = CMTime(seconds: 1, preferredTimescale: 600)
|
|
382
410
|
trimmer.enableHapticFeedback = enableHapticFeedback
|
|
@@ -469,12 +497,14 @@ class VideoTrimmerViewController: UIViewController {
|
|
|
469
497
|
addChild(playerController)
|
|
470
498
|
playerContainerView.addSubview(playerController.view)
|
|
471
499
|
playerController.view.translatesAutoresizingMaskIntoConstraints = false
|
|
472
|
-
|
|
500
|
+
playerController.view.backgroundColor = .clear
|
|
501
|
+
|
|
502
|
+
let bracketInset: CGFloat = 5
|
|
473
503
|
NSLayoutConstraint.activate([
|
|
504
|
+
playerController.view.topAnchor.constraint(equalTo: playerContainerView.topAnchor, constant: bracketInset),
|
|
505
|
+
playerController.view.bottomAnchor.constraint(equalTo: playerContainerView.bottomAnchor, constant: -bracketInset),
|
|
474
506
|
playerController.view.leadingAnchor.constraint(equalTo: playerContainerView.leadingAnchor, constant: bracketInset),
|
|
475
507
|
playerController.view.trailingAnchor.constraint(equalTo: playerContainerView.trailingAnchor, constant: -bracketInset),
|
|
476
|
-
playerController.view.topAnchor.constraint(equalTo: playerContainerView.topAnchor, constant: bracketInset),
|
|
477
|
-
playerController.view.bottomAnchor.constraint(equalTo: playerContainerView.bottomAnchor, constant: -bracketInset)
|
|
478
508
|
])
|
|
479
509
|
|
|
480
510
|
// Add observer for the end of playback
|
|
@@ -492,34 +522,33 @@ class VideoTrimmerViewController: UIViewController {
|
|
|
492
522
|
guard isVideoType else { return }
|
|
493
523
|
|
|
494
524
|
let symbolConfig = UIImage.SymbolConfiguration(pointSize: 14, weight: .medium)
|
|
495
|
-
let dimmed = UIColor.white.withAlphaComponent(0.5)
|
|
496
525
|
|
|
497
526
|
let flipBtn = UIButton(type: .system)
|
|
498
527
|
flipBtn.setImage(UIImage(systemName: "arrow.trianglehead.left.and.right.righttriangle.left.righttriangle.right", withConfiguration: symbolConfig), for: .normal)
|
|
499
|
-
flipBtn.tintColor =
|
|
528
|
+
flipBtn.tintColor = iconColor
|
|
500
529
|
flipBtn.addTarget(self, action: #selector(onFlipTapped), for: .touchUpInside)
|
|
501
530
|
|
|
502
531
|
let rotateBtn = UIButton(type: .system)
|
|
503
532
|
rotateBtn.setImage(UIImage(systemName: "rotate.left", withConfiguration: symbolConfig), for: .normal)
|
|
504
|
-
rotateBtn.tintColor =
|
|
533
|
+
rotateBtn.tintColor = iconColor
|
|
505
534
|
rotateBtn.addTarget(self, action: #selector(onRotateTapped), for: .touchUpInside)
|
|
506
535
|
|
|
507
536
|
let cropButton = UIButton(type: .system)
|
|
508
537
|
cropButton.setImage(UIImage(systemName: "crop", withConfiguration: symbolConfig), for: .normal)
|
|
509
|
-
cropButton.tintColor =
|
|
538
|
+
cropButton.tintColor = dimmedIconColor
|
|
510
539
|
cropButton.addTarget(self, action: #selector(onCropTapped), for: .touchUpInside)
|
|
511
540
|
self.cropBtn = cropButton
|
|
512
541
|
|
|
513
542
|
let undoButton = UIButton(type: .system)
|
|
514
543
|
undoButton.setImage(UIImage(systemName: "arrow.uturn.backward", withConfiguration: symbolConfig), for: .normal)
|
|
515
|
-
undoButton.tintColor =
|
|
544
|
+
undoButton.tintColor = dimmedIconColor
|
|
516
545
|
undoButton.isEnabled = false
|
|
517
546
|
undoButton.addTarget(self, action: #selector(onUndoTapped), for: .touchUpInside)
|
|
518
547
|
self.undoBtn = undoButton
|
|
519
548
|
|
|
520
549
|
let redoButton = UIButton(type: .system)
|
|
521
550
|
redoButton.setImage(UIImage(systemName: "arrow.uturn.forward", withConfiguration: symbolConfig), for: .normal)
|
|
522
|
-
redoButton.tintColor =
|
|
551
|
+
redoButton.tintColor = dimmedIconColor
|
|
523
552
|
redoButton.isEnabled = false
|
|
524
553
|
redoButton.addTarget(self, action: #selector(onRedoTapped), for: .touchUpInside)
|
|
525
554
|
self.redoBtn = redoButton
|
|
@@ -583,29 +612,63 @@ class VideoTrimmerViewController: UIViewController {
|
|
|
583
612
|
updateVideoTransform(resetCrop: true)
|
|
584
613
|
}
|
|
585
614
|
|
|
586
|
-
private func
|
|
615
|
+
private func buildVideoTransform() -> CGAffineTransform {
|
|
587
616
|
let angle = -CGFloat(rotationCount) * (.pi / 2)
|
|
588
617
|
var transform = CGAffineTransform.identity
|
|
589
|
-
|
|
590
618
|
if isFlipped {
|
|
591
619
|
transform = transform.scaledBy(x: -1, y: 1)
|
|
592
620
|
}
|
|
593
621
|
transform = transform.rotated(by: angle)
|
|
594
|
-
|
|
595
622
|
if rotationCount % 2 != 0 {
|
|
596
|
-
let
|
|
597
|
-
|
|
598
|
-
|
|
623
|
+
let pvBounds = playerController.view.bounds
|
|
624
|
+
let cBounds = playerContainerView.bounds
|
|
625
|
+
if pvBounds.width > 0 && pvBounds.height > 0 && cBounds.width > 0 && cBounds.height > 0 {
|
|
626
|
+
var videoW = pvBounds.width
|
|
627
|
+
var videoH = pvBounds.height
|
|
628
|
+
if let track = asset?.tracks(withMediaType: .video).first {
|
|
629
|
+
let raw = track.naturalSize
|
|
630
|
+
let pt = track.preferredTransform
|
|
631
|
+
let a = atan2(pt.b, pt.a)
|
|
632
|
+
let srcRotated = abs(a - .pi / 2) < 0.1 || abs(a + .pi / 2) < 0.1
|
|
633
|
+
let ds = srcRotated ? CGSize(width: raw.height, height: raw.width) : raw
|
|
634
|
+
if ds.width > 0 && ds.height > 0 {
|
|
635
|
+
let videoAR = ds.width / ds.height
|
|
636
|
+
let viewAR = pvBounds.width / pvBounds.height
|
|
637
|
+
if videoAR > viewAR {
|
|
638
|
+
videoW = pvBounds.width
|
|
639
|
+
videoH = pvBounds.width / videoAR
|
|
640
|
+
} else {
|
|
641
|
+
videoH = pvBounds.height
|
|
642
|
+
videoW = pvBounds.height * videoAR
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
let bracketMargin: CGFloat = 5
|
|
647
|
+
let availW = cBounds.width - 2 * bracketMargin
|
|
648
|
+
let availH = cBounds.height - 2 * bracketMargin
|
|
649
|
+
let fitScale = min(availW / videoH, availH / videoW)
|
|
599
650
|
transform = transform.scaledBy(x: fitScale, y: fitScale)
|
|
600
651
|
}
|
|
601
652
|
}
|
|
602
|
-
|
|
653
|
+
return transform
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
private func updateVideoTransform(resetCrop: Bool = false) {
|
|
657
|
+
let transform = buildVideoTransform()
|
|
658
|
+
if isCropActive {
|
|
659
|
+
UIView.animate(withDuration: 0.15) {
|
|
660
|
+
self.cropOverlayView?.alpha = 0
|
|
661
|
+
}
|
|
662
|
+
}
|
|
603
663
|
UIView.animate(withDuration: 0.3, delay: 0, options: [.curveEaseInOut]) {
|
|
604
664
|
self.playerController.view.transform = transform
|
|
605
665
|
} completion: { _ in
|
|
606
666
|
if resetCrop && self.isCropActive {
|
|
607
667
|
self.updateCropAllowedRect()
|
|
608
668
|
self.cropOverlayView?.resetCrop()
|
|
669
|
+
UIView.animate(withDuration: 0.15) {
|
|
670
|
+
self.cropOverlayView?.alpha = 1
|
|
671
|
+
}
|
|
609
672
|
}
|
|
610
673
|
}
|
|
611
674
|
}
|
|
@@ -645,21 +708,11 @@ class VideoTrimmerViewController: UIViewController {
|
|
|
645
708
|
rotationCount = snap.rotationCount
|
|
646
709
|
isFlipped = snap.isFlipped
|
|
647
710
|
|
|
648
|
-
let
|
|
649
|
-
var transform = CGAffineTransform.identity
|
|
650
|
-
if isFlipped { transform = transform.scaledBy(x: -1, y: 1) }
|
|
651
|
-
transform = transform.rotated(by: angle)
|
|
652
|
-
if rotationCount % 2 != 0 {
|
|
653
|
-
let bounds = playerContainerView.bounds
|
|
654
|
-
if bounds.width > 0 && bounds.height > 0 {
|
|
655
|
-
let fitScale = min(bounds.width / bounds.height, bounds.height / bounds.width)
|
|
656
|
-
transform = transform.scaledBy(x: fitScale, y: fitScale)
|
|
657
|
-
}
|
|
658
|
-
}
|
|
711
|
+
let transform = buildVideoTransform()
|
|
659
712
|
|
|
660
713
|
let wasActive = isCropActive
|
|
661
714
|
isCropActive = snap.isCropActive
|
|
662
|
-
cropBtn?.tintColor = isCropActive ?
|
|
715
|
+
cropBtn?.tintColor = isCropActive ? iconColor : dimmedIconColor
|
|
663
716
|
|
|
664
717
|
UIView.animate(withDuration: 0.3, delay: 0, options: [.curveEaseInOut]) {
|
|
665
718
|
self.playerController.view.transform = transform
|
|
@@ -691,10 +744,9 @@ class VideoTrimmerViewController: UIViewController {
|
|
|
691
744
|
}
|
|
692
745
|
|
|
693
746
|
private func updateUndoRedoButtons() {
|
|
694
|
-
|
|
695
|
-
undoBtn?.tintColor = undoStack.isEmpty ? dimmed : .white
|
|
747
|
+
undoBtn?.tintColor = undoStack.isEmpty ? dimmedIconColor : iconColor
|
|
696
748
|
undoBtn?.isEnabled = !undoStack.isEmpty
|
|
697
|
-
redoBtn?.tintColor = redoStack.isEmpty ?
|
|
749
|
+
redoBtn?.tintColor = redoStack.isEmpty ? dimmedIconColor : iconColor
|
|
698
750
|
redoBtn?.isEnabled = !redoStack.isEmpty
|
|
699
751
|
}
|
|
700
752
|
|
|
@@ -702,7 +754,7 @@ class VideoTrimmerViewController: UIViewController {
|
|
|
702
754
|
|
|
703
755
|
@objc private func onCropTapped() {
|
|
704
756
|
isCropActive.toggle()
|
|
705
|
-
cropBtn?.tintColor = isCropActive ?
|
|
757
|
+
cropBtn?.tintColor = isCropActive ? iconColor : dimmedIconColor
|
|
706
758
|
|
|
707
759
|
if enableHapticFeedback {
|
|
708
760
|
UIImpactFeedbackGenerator(style: .light).impactOccurred()
|
|
@@ -743,6 +795,7 @@ class VideoTrimmerViewController: UIViewController {
|
|
|
743
795
|
|
|
744
796
|
private func createCropOverlay() {
|
|
745
797
|
let overlay = CropOverlayView()
|
|
798
|
+
overlay.isLightTheme = isLightTheme
|
|
746
799
|
overlay.translatesAutoresizingMaskIntoConstraints = false
|
|
747
800
|
overlay.alpha = 0
|
|
748
801
|
playerContainerView.addSubview(overlay)
|
|
@@ -916,6 +969,8 @@ class VideoTrimmerViewController: UIViewController {
|
|
|
916
969
|
minimumDuration = minDuration
|
|
917
970
|
}
|
|
918
971
|
|
|
972
|
+
isLightTheme = (config["theme"] as? String) == "light"
|
|
973
|
+
|
|
919
974
|
cancelButtonText = config["cancelButtonText"] as? String ?? "Cancel"
|
|
920
975
|
saveButtonText = config["saveButtonText"] as? String ?? "Save"
|
|
921
976
|
jumpToPositionOnLoad = config["jumpToPositionOnLoad"] as? Double ?? 0
|
|
@@ -927,12 +982,26 @@ class VideoTrimmerViewController: UIViewController {
|
|
|
927
982
|
headerTextSize = config["headerTextSize"] as? Int ?? 16
|
|
928
983
|
headerTextColor = config["headerTextColor"] as? Double
|
|
929
984
|
|
|
930
|
-
// Handle new color properties
|
|
931
985
|
if let trimmerColorValue = config["trimmerColor"] as? Double {
|
|
932
986
|
trimmerColor = RCTConvert.uiColor(trimmerColorValue) ?? UIColor.systemYellow
|
|
933
987
|
}
|
|
934
988
|
if let handleIconColorValue = config["handleIconColor"] as? Double {
|
|
935
|
-
handleIconColor = RCTConvert.uiColor(handleIconColorValue) ??
|
|
989
|
+
handleIconColor = RCTConvert.uiColor(handleIconColorValue) ?? (isLightTheme ? .white : .black)
|
|
990
|
+
}
|
|
991
|
+
if let v = config["waveformColor"] as? Double {
|
|
992
|
+
waveformBarColor = RCTConvert.uiColor(v) ?? .white
|
|
993
|
+
}
|
|
994
|
+
if let v = config["waveformBackgroundColor"] as? Double {
|
|
995
|
+
waveformBgColor = RCTConvert.uiColor(v) ?? UIColor(red: 0.204, green: 0.471, blue: 0.965, alpha: 1)
|
|
996
|
+
}
|
|
997
|
+
if let v = config["waveformBarWidth"] as? Double, v > 0 {
|
|
998
|
+
waveformBarWidth = CGFloat(v)
|
|
999
|
+
}
|
|
1000
|
+
if let v = config["waveformBarGap"] as? Double, v >= 0 {
|
|
1001
|
+
waveformBarGap = CGFloat(v)
|
|
1002
|
+
}
|
|
1003
|
+
if let v = config["waveformBarCornerRadius"] as? Double, v >= 0 {
|
|
1004
|
+
waveformBarCornerRadius = CGFloat(v)
|
|
936
1005
|
}
|
|
937
1006
|
}
|
|
938
1007
|
|
|
@@ -954,7 +1023,8 @@ class VideoTrimmerViewController: UIViewController {
|
|
|
954
1023
|
|
|
955
1024
|
if jumpToPositionOnLoad > 0 {
|
|
956
1025
|
let duration = (asset?.duration.seconds ?? 0) * 1000
|
|
957
|
-
let
|
|
1026
|
+
let endMs = trimmer.selectedRange.end.seconds * 1000
|
|
1027
|
+
let time = min(jumpToPositionOnLoad, min(duration, endMs))
|
|
958
1028
|
let cmtime = CMTime(value: CMTimeValue(time), timescale: 1000)
|
|
959
1029
|
|
|
960
1030
|
self.seek(to: cmtime)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeVideoTrim.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;;AAGlD;AACA;AACA;;AAwBA;AACA;AACA;;
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeVideoTrim.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;;AAGlD;AACA;AACA;;AAwBA;AACA;AACA;;AA+GA;AACA;AACA;;AAQA;AACA;AACA;;AAUA;AACA;AACA;;AAcA;AACA;AACA;;AAmEA,eAAeA,mBAAmB,CAACC,YAAY,CAAO,WAAW,CAAC","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -63,6 +63,11 @@ function createEditorConfig(overrides = {}) {
|
|
|
63
63
|
alertOnFailTitle: 'Error',
|
|
64
64
|
alertOnFailMessage: 'Fail to load media. Possibly invalid file or no network connection',
|
|
65
65
|
alertOnFailCloseText: 'Close',
|
|
66
|
+
waveformColor: processColor('white'),
|
|
67
|
+
waveformBackgroundColor: processColor('#3478F6'),
|
|
68
|
+
waveformBarWidth: 3,
|
|
69
|
+
waveformBarGap: 2,
|
|
70
|
+
waveformBarCornerRadius: 1.5,
|
|
66
71
|
...createBaseOptions(overrides),
|
|
67
72
|
...overrides
|
|
68
73
|
};
|
|
@@ -88,16 +93,23 @@ export function showEditor(filePath, config) {
|
|
|
88
93
|
const {
|
|
89
94
|
headerTextColor,
|
|
90
95
|
trimmerColor,
|
|
91
|
-
handleIconColor
|
|
96
|
+
handleIconColor,
|
|
97
|
+
waveformColor,
|
|
98
|
+
waveformBackgroundColor
|
|
92
99
|
} = config;
|
|
93
|
-
const
|
|
100
|
+
const isLight = config.theme === 'light';
|
|
101
|
+
const _headerTextColor = processColor(headerTextColor || (isLight ? 'black' : 'white'));
|
|
94
102
|
const _trimmerColor = processColor(trimmerColor || '#f1d247');
|
|
95
|
-
const _handleIconColor = processColor(handleIconColor || 'black');
|
|
103
|
+
const _handleIconColor = processColor(handleIconColor || (isLight ? 'white' : 'black'));
|
|
104
|
+
const _waveformColor = processColor(waveformColor || 'white');
|
|
105
|
+
const _waveformBackgroundColor = processColor(waveformBackgroundColor || '#3478F6');
|
|
96
106
|
VideoTrim.showEditor(filePath, createEditorConfig({
|
|
97
107
|
...config,
|
|
98
108
|
headerTextColor: _headerTextColor,
|
|
99
109
|
trimmerColor: _trimmerColor,
|
|
100
|
-
handleIconColor: _handleIconColor
|
|
110
|
+
handleIconColor: _handleIconColor,
|
|
111
|
+
waveformColor: _waveformColor,
|
|
112
|
+
waveformBackgroundColor: _waveformBackgroundColor
|
|
101
113
|
}));
|
|
102
114
|
}
|
|
103
115
|
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["VideoTrimNewArch","VideoTrimOldArch","processColor","isFabric","global","nativeFabricUIManager","VideoTrim","createBaseOptions","overrides","saveToPhoto","type","outputExt","removeAfterSavedToPhoto","removeAfterFailedToSavePhoto","enablePreciseTrimming","createEditorConfig","enableHapticFeedback","maxDuration","minDuration","openDocumentsOnFinish","openShareSheetOnFinish","removeAfterSavedToDocuments","removeAfterFailedToSaveDocuments","removeAfterShared","removeAfterFailedToShare","cancelButtonText","saveButtonText","enableCancelDialog","cancelDialogTitle","cancelDialogMessage","cancelDialogCancelText","cancelDialogConfirmText","enableSaveDialog","saveDialogTitle","saveDialogMessage","saveDialogCancelText","saveDialogConfirmText","trimmingText","fullScreenModalIOS","autoplay","jumpToPositionOnLoad","closeWhenFinish","enableCancelTrimming","cancelTrimmingButtonText","enableCancelTrimmingDialog","cancelTrimmingDialogTitle","cancelTrimmingDialogMessage","cancelTrimmingDialogCancelText","cancelTrimmingDialogConfirmText","headerText","headerTextSize","headerTextColor","trimmerColor","handleIconColor","zoomOnWaitingDuration","alertOnFailToLoad","alertOnFailTitle","alertOnFailMessage","alertOnFailCloseText","createTrimOptions","startTime","endTime","showEditor","filePath","config","_headerTextColor","_trimmerColor","_handleIconColor","listFiles","cleanFiles","deleteFile","trim","length","Error","closeEditor","isValidFile","url","options"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,gBAAgB,MAAM,sBAAmB;AAChD,OAAOC,gBAAgB,MAAM,cAAW;AAQxC,SAASC,YAAY,QAAQ,cAAc;;AAE3C;AACA,MAAMC,QAAQ,GAAG,CAAC,CAAEC,MAAM,CAASC,qBAAqB;AACxD,MA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,UAAU;IACrCC,2BAA2B,EAAE,uCAAuC;IACpEC,8BAA8B,EAAE,OAAO;IACvCC,+BAA+B,EAAE,SAAS;IAC1CC,UAAU,EAAE,EAAE;IACdC,cAAc,EAAE,EAAE;IAClBC,eAAe,EAAEjD,YAAY,CAAC,OAAO,CAAW;IAChDkD,YAAY,EAAElD,YAAY,CAAC,SAAS,CAAW;IAC/CmD,eAAe,EAAEnD,YAAY,CAAC,OAAO,CAAW;IAChDoD,qBAAqB,EAAE,IAAI;IAC3BC,iBAAiB,EAAE,IAAI;IACvBC,gBAAgB,EAAE,OAAO;IACzBC,kBAAkB,EAChB,oEAAoE;IACtEC,oBAAoB,EAAE,OAAO;
|
|
1
|
+
{"version":3,"names":["VideoTrimNewArch","VideoTrimOldArch","processColor","isFabric","global","nativeFabricUIManager","VideoTrim","createBaseOptions","overrides","saveToPhoto","type","outputExt","removeAfterSavedToPhoto","removeAfterFailedToSavePhoto","enablePreciseTrimming","createEditorConfig","enableHapticFeedback","maxDuration","minDuration","openDocumentsOnFinish","openShareSheetOnFinish","removeAfterSavedToDocuments","removeAfterFailedToSaveDocuments","removeAfterShared","removeAfterFailedToShare","cancelButtonText","saveButtonText","enableCancelDialog","cancelDialogTitle","cancelDialogMessage","cancelDialogCancelText","cancelDialogConfirmText","enableSaveDialog","saveDialogTitle","saveDialogMessage","saveDialogCancelText","saveDialogConfirmText","trimmingText","fullScreenModalIOS","autoplay","jumpToPositionOnLoad","closeWhenFinish","enableCancelTrimming","cancelTrimmingButtonText","enableCancelTrimmingDialog","cancelTrimmingDialogTitle","cancelTrimmingDialogMessage","cancelTrimmingDialogCancelText","cancelTrimmingDialogConfirmText","headerText","headerTextSize","headerTextColor","trimmerColor","handleIconColor","zoomOnWaitingDuration","alertOnFailToLoad","alertOnFailTitle","alertOnFailMessage","alertOnFailCloseText","waveformColor","waveformBackgroundColor","waveformBarWidth","waveformBarGap","waveformBarCornerRadius","createTrimOptions","startTime","endTime","showEditor","filePath","config","isLight","theme","_headerTextColor","_trimmerColor","_handleIconColor","_waveformColor","_waveformBackgroundColor","listFiles","cleanFiles","deleteFile","trim","length","Error","closeEditor","isValidFile","url","options"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,gBAAgB,MAAM,sBAAmB;AAChD,OAAOC,gBAAgB,MAAM,cAAW;AAQxC,SAASC,YAAY,QAAQ,cAAc;;AAE3C;AACA,MAAMC,QAAQ,GAAG,CAAC,CAAEC,MAAM,CAASC,qBAAqB;AACxD,MAAMC,SAAS,GAAGH,QAAQ,GAAGH,gBAAgB,GAAGC,gBAAgB;AAEhE,SAASM,iBAAiBA,CAACC,SAA+B,GAAG,CAAC,CAAC,EAAe;EAC5E,OAAO;IACLC,WAAW,EAAE,KAAK;IAClBC,IAAI,EAAE,OAAO;IACbC,SAAS,EAAE,KAAK;IAChBC,uBAAuB,EAAE,KAAK;IAC9BC,4BAA4B,EAAE,KAAK;IACnCC,qBAAqB,EAAE,KAAK;IAC5B,GAAGN;EACL,CAAC;AACH;AAEA,SAASO,kBAAkBA,CACzBP,SAAgC,GAAG,CAAC,CAAC,EACvB;EACd,OAAO;IACLQ,oBAAoB,EAAE,IAAI;IAC1BC,WAAW,EAAE,CAAC,CAAC;IACfC,WAAW,EAAE,CAAC,CAAC;IACfC,qBAAqB,EAAE,KAAK;IAC5BC,sBAAsB,EAAE,KAAK;IAC7BC,2BAA2B,EAAE,KAAK;IAClCC,gCAAgC,EAAE,KAAK;IACvCC,iBAAiB,EAAE,KAAK;IACxBC,wBAAwB,EAAE,KAAK;IAC/BC,gBAAgB,EAAE,QAAQ;IAC1BC,cAAc,EAAE,MAAM;IACtBC,kBAAkB,EAAE,IAAI;IACxBC,iBAAiB,EAAE,UAAU;IAC7BC,mBAAmB,EAAE,8BAA8B;IACnDC,sBAAsB,EAAE,OAAO;IAC/BC,uBAAuB,EAAE,SAAS;IAClCC,gBAAgB,EAAE,IAAI;IACtBC,eAAe,EAAE,eAAe;IAChCC,iBAAiB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,CAACC,MAAM,EAAE;IAC5B,MAAM,IAAIC,KAAK,CAAC,4BAA4B,CAAC;EAC/C;EACA,OAAO5E,SAAS,CAACyE,UAAU,CAACX,QAAQ,CAAC;AACvC;;AAEA;AACA;AACA;AACA,OAAO,SAASe,WAAWA,CAAA,EAAS;EAClC,OAAO7E,SAAS,CAAC6E,WAAW,CAAC,CAAC;AAChC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAACC,GAAW,EAAiC;EACtE,OAAO/E,SAAS,CAAC8E,WAAW,CAACC,GAAG,CAAC;AACnC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASL,IAAIA,CAClBK,GAAW,EACXC,OAA6B,EACR;EACrB,OAAOhF,SAAS,CAAC0E,IAAI,CAACK,GAAG,EAAErB,iBAAiB,CAACsB,OAAO,CAAC,CAAC;AACxD;AAEA,cAAc,sBAAmB;AACjC,eAAehF,SAAS","ignoreList":[]}
|
|
@@ -121,6 +121,21 @@ export interface EditorConfig extends BaseOptions {
|
|
|
121
121
|
* this duration around the current trim position for more precise editing.
|
|
122
122
|
*/
|
|
123
123
|
zoomOnWaitingDuration?: number;
|
|
124
|
+
/**
|
|
125
|
+
* Editor theme. `"dark"` (default) uses a black background with white UI elements.
|
|
126
|
+
* `"light"` uses a white background with black icons/text and white trimmer-handle chevrons.
|
|
127
|
+
*/
|
|
128
|
+
theme?: string;
|
|
129
|
+
/** Color of the audio waveform bars as a `processColor` value. */
|
|
130
|
+
waveformColor?: number;
|
|
131
|
+
/** Background color behind the audio waveform bars as a `processColor` value. */
|
|
132
|
+
waveformBackgroundColor?: number;
|
|
133
|
+
/** Width of each waveform bar in dp/pt (default: `3`). */
|
|
134
|
+
waveformBarWidth?: number;
|
|
135
|
+
/** Gap between waveform bars in dp/pt (default: `2`). */
|
|
136
|
+
waveformBarGap?: number;
|
|
137
|
+
/** Corner radius of waveform bars in dp/pt (default: `1.5`). */
|
|
138
|
+
waveformBarCornerRadius?: number;
|
|
124
139
|
}
|
|
125
140
|
/**
|
|
126
141
|
* Options for headless (non-UI) trim operations.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeVideoTrim.d.ts","sourceRoot":"","sources":["../../../src/NativeVideoTrim.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAE9E;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,qEAAqE;IACrE,WAAW,EAAE,OAAO,CAAC;IACrB,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,SAAS,EAAE,MAAM,CAAC;IAClB,sFAAsF;IACtF,uBAAuB,EAAE,OAAO,CAAC;IACjC,8EAA8E;IAC9E,4BAA4B,EAAE,OAAO,CAAC;IACtC;;;;;;;;OAQG;IACH,qBAAqB,EAAE,OAAO,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,YAAa,SAAQ,WAAW;IAC/C,2EAA2E;IAC3E,oBAAoB,EAAE,OAAO,CAAC;IAC9B,+FAA+F;IAC/F,WAAW,EAAE,MAAM,CAAC;IACpB,+FAA+F;IAC/F,WAAW,EAAE,MAAM,CAAC;IACpB,8EAA8E;IAC9E,qBAAqB,EAAE,OAAO,CAAC;IAC/B,+DAA+D;IAC/D,sBAAsB,EAAE,OAAO,CAAC;IAChC,8EAA8E;IAC9E,2BAA2B,EAAE,OAAO,CAAC;IACrC,sEAAsE;IACtE,gCAAgC,EAAE,OAAO,CAAC;IAC1C,kEAAkE;IAClE,iBAAiB,EAAE,OAAO,CAAC;IAC3B,0DAA0D;IAC1D,wBAAwB,EAAE,OAAO,CAAC;IAClC,kCAAkC;IAClC,gBAAgB,EAAE,MAAM,CAAC;IACzB,gCAAgC;IAChC,cAAc,EAAE,MAAM,CAAC;IACvB,+EAA+E;IAC/E,kBAAkB,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yF;IACzF,QAAQ,CAAC,gBAAgB,EAAE,YAAY,CAAC;QACtC,gDAAgD;QAChD,UAAU,EAAE,MAAM,CAAC;QACnB,uDAAuD;QACvD,SAAS,EAAE,MAAM,CAAC;QAClB,qDAAqD;QACrD,OAAO,EAAE,MAAM,CAAC;QAChB,oDAAoD;QACpD,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;IACH,sDAAsD;IACtD,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;QAC3B,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC,CAAC;IACH,+DAA+D;IAC/D,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;QAClC,SAAS,EAAE,MAAM,CAAC;QAClB,gBAAgB,EAAE,MAAM,CAAC;QACzB,QAAQ,EAAE,MAAM,CAAC;QACjB,YAAY,EAAE,MAAM,CAAC;QACrB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC,CAAC;IACH,oEAAoE;IACpE,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;QAC7B,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC,CAAC;IACH,sEAAsE;IACtE,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;QAC5B,oDAAoD;QACpD,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;CACJ;;AAED,wBAAmE"}
|
|
@@ -8,10 +8,12 @@ declare const VideoTrim: any;
|
|
|
8
8
|
* @param {Function} onEvent: event callback
|
|
9
9
|
* @returns {void}
|
|
10
10
|
*/
|
|
11
|
-
export declare function showEditor(filePath: string, config: Partial<Omit<EditorConfig, 'headerTextColor' | 'trimmerColor' | 'handleIconColor'>> & {
|
|
11
|
+
export declare function showEditor(filePath: string, config: Partial<Omit<EditorConfig, 'headerTextColor' | 'trimmerColor' | 'handleIconColor' | 'waveformColor' | 'waveformBackgroundColor'>> & {
|
|
12
12
|
headerTextColor?: string;
|
|
13
13
|
trimmerColor?: string;
|
|
14
14
|
handleIconColor?: string;
|
|
15
|
+
waveformColor?: string;
|
|
16
|
+
waveformBackgroundColor?: string;
|
|
15
17
|
}): void;
|
|
16
18
|
/**
|
|
17
19
|
* List output files generated at all time
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,YAAY,EACZ,oBAAoB,EACpB,WAAW,EACX,UAAU,EACX,MAAM,mBAAmB,CAAC;AAK3B,QAAA,MAAM,SAAS,KAAiD,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,YAAY,EACZ,oBAAoB,EACpB,WAAW,EACX,UAAU,EACX,MAAM,mBAAmB,CAAC;AAK3B,QAAA,MAAM,SAAS,KAAiD,CAAC;AAiFjE;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACxB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,OAAO,CACb,IAAI,CACF,YAAY,EACV,iBAAiB,GACjB,cAAc,GACd,iBAAiB,GACjB,eAAe,GACf,yBAAyB,CAC5B,CACF,GAAG;IACF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC,GACA,IAAI,CAgCN;AAED;;;;GAIG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAE7C;AAED;;;;GAIG;AACH,wBAAgB,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,CAE5C;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAK7D;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAElC;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAEtE;AAED;;;;;;GAMG;AACH,wBAAgB,IAAI,CAClB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,GAC5B,OAAO,CAAC,UAAU,CAAC,CAErB;AAED,cAAc,mBAAmB,CAAC;AAClC,eAAe,SAAS,CAAC"}
|
package/package.json
CHANGED
package/src/NativeVideoTrim.ts
CHANGED
|
@@ -124,6 +124,21 @@ export interface EditorConfig extends BaseOptions {
|
|
|
124
124
|
* this duration around the current trim position for more precise editing.
|
|
125
125
|
*/
|
|
126
126
|
zoomOnWaitingDuration?: number;
|
|
127
|
+
/**
|
|
128
|
+
* Editor theme. `"dark"` (default) uses a black background with white UI elements.
|
|
129
|
+
* `"light"` uses a white background with black icons/text and white trimmer-handle chevrons.
|
|
130
|
+
*/
|
|
131
|
+
theme?: string;
|
|
132
|
+
/** Color of the audio waveform bars as a `processColor` value. */
|
|
133
|
+
waveformColor?: number;
|
|
134
|
+
/** Background color behind the audio waveform bars as a `processColor` value. */
|
|
135
|
+
waveformBackgroundColor?: number;
|
|
136
|
+
/** Width of each waveform bar in dp/pt (default: `3`). */
|
|
137
|
+
waveformBarWidth?: number;
|
|
138
|
+
/** Gap between waveform bars in dp/pt (default: `2`). */
|
|
139
|
+
waveformBarGap?: number;
|
|
140
|
+
/** Corner radius of waveform bars in dp/pt (default: `1.5`). */
|
|
141
|
+
waveformBarCornerRadius?: number;
|
|
127
142
|
}
|
|
128
143
|
|
|
129
144
|
/**
|
package/src/index.tsx
CHANGED
|
@@ -73,6 +73,11 @@ function createEditorConfig(
|
|
|
73
73
|
alertOnFailMessage:
|
|
74
74
|
'Fail to load media. Possibly invalid file or no network connection',
|
|
75
75
|
alertOnFailCloseText: 'Close',
|
|
76
|
+
waveformColor: processColor('white') as number,
|
|
77
|
+
waveformBackgroundColor: processColor('#3478F6') as number,
|
|
78
|
+
waveformBarWidth: 3,
|
|
79
|
+
waveformBarGap: 2,
|
|
80
|
+
waveformBarCornerRadius: 1.5,
|
|
76
81
|
...createBaseOptions(overrides),
|
|
77
82
|
...overrides,
|
|
78
83
|
};
|
|
@@ -98,17 +103,41 @@ function createTrimOptions(overrides: Partial<TrimOptions> = {}): TrimOptions {
|
|
|
98
103
|
export function showEditor(
|
|
99
104
|
filePath: string,
|
|
100
105
|
config: Partial<
|
|
101
|
-
Omit<
|
|
106
|
+
Omit<
|
|
107
|
+
EditorConfig,
|
|
108
|
+
| 'headerTextColor'
|
|
109
|
+
| 'trimmerColor'
|
|
110
|
+
| 'handleIconColor'
|
|
111
|
+
| 'waveformColor'
|
|
112
|
+
| 'waveformBackgroundColor'
|
|
113
|
+
>
|
|
102
114
|
> & {
|
|
103
115
|
headerTextColor?: string;
|
|
104
116
|
trimmerColor?: string;
|
|
105
117
|
handleIconColor?: string;
|
|
118
|
+
waveformColor?: string;
|
|
119
|
+
waveformBackgroundColor?: string;
|
|
106
120
|
}
|
|
107
121
|
): void {
|
|
108
|
-
const {
|
|
109
|
-
|
|
122
|
+
const {
|
|
123
|
+
headerTextColor,
|
|
124
|
+
trimmerColor,
|
|
125
|
+
handleIconColor,
|
|
126
|
+
waveformColor,
|
|
127
|
+
waveformBackgroundColor,
|
|
128
|
+
} = config;
|
|
129
|
+
const isLight = config.theme === 'light';
|
|
130
|
+
const _headerTextColor = processColor(
|
|
131
|
+
headerTextColor || (isLight ? 'black' : 'white')
|
|
132
|
+
);
|
|
110
133
|
const _trimmerColor = processColor(trimmerColor || '#f1d247');
|
|
111
|
-
const _handleIconColor = processColor(
|
|
134
|
+
const _handleIconColor = processColor(
|
|
135
|
+
handleIconColor || (isLight ? 'white' : 'black')
|
|
136
|
+
);
|
|
137
|
+
const _waveformColor = processColor(waveformColor || 'white');
|
|
138
|
+
const _waveformBackgroundColor = processColor(
|
|
139
|
+
waveformBackgroundColor || '#3478F6'
|
|
140
|
+
);
|
|
112
141
|
|
|
113
142
|
VideoTrim.showEditor(
|
|
114
143
|
filePath,
|
|
@@ -117,6 +146,8 @@ export function showEditor(
|
|
|
117
146
|
headerTextColor: _headerTextColor as any,
|
|
118
147
|
trimmerColor: _trimmerColor as any,
|
|
119
148
|
handleIconColor: _handleIconColor as any,
|
|
149
|
+
waveformColor: _waveformColor as any,
|
|
150
|
+
waveformBackgroundColor: _waveformBackgroundColor as any,
|
|
120
151
|
})
|
|
121
152
|
);
|
|
122
153
|
}
|