Skip to content

Commit a92ec90

Browse files
authored
Merge pull request #15 from pouyayarandi/play-sound-in-silent-mode
Play sound in silent mode with volume up
2 parents 0a907be + c999151 commit a92ec90

File tree

2 files changed

+130
-86
lines changed

2 files changed

+130
-86
lines changed

Sources/DarkRoom/Configuraion/DarkRoomVideoPlayerControllerConfiguration.swift

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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

3131
public 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

5356
public 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

Comments
 (0)