Skip to content

Commit 0a34536

Browse files
committed
Update LoopPlayerView.swift
1 parent ceba96e commit 0a34536

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

Sources/swiftui-loop-videoplayer/LoopPlayerView.swift

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,33 @@ public struct LoopPlayerView: UIViewRepresentable {
1818

1919
// MARK: - Life circle
2020

21-
public init(fileName : String){
22-
self.settings = Settings{
23-
FileName(fileName)
21+
/// Player initializer
22+
/// - Parameters:
23+
/// - fileName: Name of the video to play
24+
/// - ext: Video extension
25+
/// - gravity: A structure that defines how a layer displays a player’s visual content within the layer’s bounds
26+
/// - eText: Error message text if file is not found
27+
/// - eFontSize: Size of the error text
28+
public init(
29+
fileName: String,
30+
ext: String = "mp4",
31+
gravity: AVLayerVideoGravity = .resizeAspect,
32+
eText : String = "Resource is not found",
33+
eFontSize : CGFloat = 17.0
34+
) {
35+
self.settings = Settings{
36+
FileName(fileName)
37+
Ext(ext)
38+
Gravity(gravity)
39+
ErrorGroup{
40+
EText(eText)
41+
EFontSize(eFontSize)
42+
}
43+
}
2444
}
25-
}
2645

46+
/// Player initializer in a declarative way
47+
/// - Parameter settings: Set of settings
2748
public init(_ settings : () -> Settings) {
2849
self.settings = settings()
2950
}

0 commit comments

Comments
 (0)