1
1
//
2
2
// DarkRoomVideoPlayerControllerConfiguration.swift
3
- //
3
+ //
4
4
//
5
5
// Created by Kiarash Vosough on 8/2/22.
6
6
//
@@ -29,51 +29,57 @@ import UIKit
29
29
// MARK: - Abstraction
30
30
31
31
public protocol DarkRoomVideoPlayerControllerConfiguration {
32
-
32
+
33
33
var loadingViewConfiguration : DarkRoomLoadingViewConfiguration { get }
34
-
34
+
35
35
var controlViewConfiguration : DarkRoomControlViewConfiguration { get }
36
-
36
+
37
37
var videoPlayerBackgroudColor : UIColor { get }
38
-
38
+
39
39
var showsPlaybackControls : Bool { get }
40
-
40
+
41
41
var videoContentMode : UIView . ContentMode { get }
42
-
42
+
43
43
/// Amount of pan needed to dismiss the carousel.
44
44
/// The difference is calculated by subtracting start and the end point of pan gesture.
45
45
var dismissPanAmount : CGFloat { get }
46
-
46
+
47
47
/// A smooth shadow will applied to bottom of videoPlayer with the height of 200 if set to be true
48
48
var isBottomShadowEnabled : Bool { get }
49
+
50
+ /// Plays the sound of video in silent mode if volume turns up.
51
+ var playSoundInSilentModeWithVolumeUp : Bool { get }
49
52
}
50
53
51
54
// MARK: - Implementation
52
55
53
56
public struct DarkRoomVideoPlayerControllerDefaultConfiguration : DarkRoomVideoPlayerControllerConfiguration {
54
-
57
+
55
58
public var loadingViewConfiguration : DarkRoomLoadingViewConfiguration
56
-
59
+
57
60
public var controlViewConfiguration : DarkRoomControlViewConfiguration
58
-
61
+
59
62
public var videoPlayerBackgroudColor : UIColor
60
-
63
+
61
64
public var showsPlaybackControls : Bool
62
-
65
+
63
66
public var videoContentMode : UIView . ContentMode
64
-
67
+
65
68
public var dismissPanAmount : CGFloat
66
-
69
+
67
70
public var isBottomShadowEnabled : Bool
68
-
71
+
72
+ public var playSoundInSilentModeWithVolumeUp : Bool
73
+
69
74
public init (
70
75
loadingViewConfiguration: DarkRoomLoadingViewConfiguration = DarkRoomLoadingViewDefaultConfiguration ( ) ,
71
76
controlViewConfiguration: DarkRoomControlViewConfiguration = DarkRoomControlViewDefaultConfiguration ( ) ,
72
77
videoPlayerBackgroudColor: UIColor = . black,
73
78
showsPlaybackControls: Bool = true ,
74
79
videoContentMode: UIView . ContentMode = . scaleAspectFit,
75
80
dismissPanAmount: CGFloat = 70 ,
76
- isBottomShadowEnabled: Bool = true
81
+ isBottomShadowEnabled: Bool = true ,
82
+ playSoundInSilentModeWithVolumeUp: Bool = false
77
83
) {
78
84
self . loadingViewConfiguration = loadingViewConfiguration
79
85
self . controlViewConfiguration = controlViewConfiguration
@@ -82,5 +88,6 @@ public struct DarkRoomVideoPlayerControllerDefaultConfiguration: DarkRoomVideoPl
82
88
self . videoContentMode = videoContentMode
83
89
self . dismissPanAmount = dismissPanAmount
84
90
self . isBottomShadowEnabled = isBottomShadowEnabled
91
+ self . playSoundInSilentModeWithVolumeUp = playSoundInSilentModeWithVolumeUp
85
92
}
86
93
}
0 commit comments