11//
22// DarkRoomVideoPlayerControllerConfiguration.swift
3- //
3+ //
44//
55// Created by Kiarash Vosough on 8/2/22.
66//
@@ -29,51 +29,57 @@ import UIKit
2929// MARK: - Abstraction
3030
3131public protocol DarkRoomVideoPlayerControllerConfiguration {
32-
32+
3333 var loadingViewConfiguration : DarkRoomLoadingViewConfiguration { get }
34-
34+
3535 var controlViewConfiguration : DarkRoomControlViewConfiguration { get }
36-
36+
3737 var videoPlayerBackgroudColor : UIColor { get }
38-
38+
3939 var showsPlaybackControls : Bool { get }
40-
40+
4141 var videoContentMode : UIView . ContentMode { get }
42-
42+
4343 /// Amount of pan needed to dismiss the carousel.
4444 /// The difference is calculated by subtracting start and the end point of pan gesture.
4545 var dismissPanAmount : CGFloat { get }
46-
46+
4747 /// A smooth shadow will applied to bottom of videoPlayer with the height of 200 if set to be true
4848 var isBottomShadowEnabled : Bool { get }
49+
50+ /// Plays the sound of video in silent mode if volume turns up.
51+ var playSoundInSilentModeWithVolumeUp : Bool { get }
4952}
5053
5154// MARK: - Implementation
5255
5356public struct DarkRoomVideoPlayerControllerDefaultConfiguration : DarkRoomVideoPlayerControllerConfiguration {
54-
57+
5558 public var loadingViewConfiguration : DarkRoomLoadingViewConfiguration
56-
59+
5760 public var controlViewConfiguration : DarkRoomControlViewConfiguration
58-
61+
5962 public var videoPlayerBackgroudColor : UIColor
60-
63+
6164 public var showsPlaybackControls : Bool
62-
65+
6366 public var videoContentMode : UIView . ContentMode
64-
67+
6568 public var dismissPanAmount : CGFloat
66-
69+
6770 public var isBottomShadowEnabled : Bool
68-
71+
72+ public var playSoundInSilentModeWithVolumeUp : Bool
73+
6974 public init (
7075 loadingViewConfiguration: DarkRoomLoadingViewConfiguration = DarkRoomLoadingViewDefaultConfiguration ( ) ,
7176 controlViewConfiguration: DarkRoomControlViewConfiguration = DarkRoomControlViewDefaultConfiguration ( ) ,
7277 videoPlayerBackgroudColor: UIColor = . black,
7378 showsPlaybackControls: Bool = true ,
7479 videoContentMode: UIView . ContentMode = . scaleAspectFit,
7580 dismissPanAmount: CGFloat = 70 ,
76- isBottomShadowEnabled: Bool = true
81+ isBottomShadowEnabled: Bool = true ,
82+ playSoundInSilentModeWithVolumeUp: Bool = false
7783 ) {
7884 self . loadingViewConfiguration = loadingViewConfiguration
7985 self . controlViewConfiguration = controlViewConfiguration
@@ -82,5 +88,6 @@ public struct DarkRoomVideoPlayerControllerDefaultConfiguration: DarkRoomVideoPl
8288 self . videoContentMode = videoContentMode
8389 self . dismissPanAmount = dismissPanAmount
8490 self . isBottomShadowEnabled = isBottomShadowEnabled
91+ self . playSoundInSilentModeWithVolumeUp = playSoundInSilentModeWithVolumeUp
8592 }
8693}
0 commit comments