Skip to content

Commit 90c1e65

Browse files
committed
Add sample hls server implementation (Livestream)
1 parent 54251c4 commit 90c1e65

File tree

9 files changed

+428
-0
lines changed

9 files changed

+428
-0
lines changed

.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1250"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "SwifterHlsMock"
18+
BuildableName = "SwifterHlsMock"
19+
BlueprintName = "SwifterHlsMock"
20+
ReferencedContainer = "container:">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
<BuildActionEntry
24+
buildForTesting = "YES"
25+
buildForRunning = "YES"
26+
buildForProfiling = "NO"
27+
buildForArchiving = "NO"
28+
buildForAnalyzing = "YES">
29+
<BuildableReference
30+
BuildableIdentifier = "primary"
31+
BlueprintIdentifier = "SwifterHlsMockTests"
32+
BuildableName = "SwifterHlsMockTests"
33+
BlueprintName = "SwifterHlsMockTests"
34+
ReferencedContainer = "container:">
35+
</BuildableReference>
36+
</BuildActionEntry>
37+
</BuildActionEntries>
38+
</BuildAction>
39+
<TestAction
40+
buildConfiguration = "Debug"
41+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
42+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
43+
shouldUseLaunchSchemeArgsEnv = "YES">
44+
<Testables>
45+
<TestableReference
46+
skipped = "NO">
47+
<BuildableReference
48+
BuildableIdentifier = "primary"
49+
BlueprintIdentifier = "SwifterHlsMockTests"
50+
BuildableName = "SwifterHlsMockTests"
51+
BlueprintName = "SwifterHlsMockTests"
52+
ReferencedContainer = "container:">
53+
</BuildableReference>
54+
</TestableReference>
55+
</Testables>
56+
</TestAction>
57+
<LaunchAction
58+
buildConfiguration = "Debug"
59+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
60+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
61+
launchStyle = "0"
62+
useCustomWorkingDirectory = "NO"
63+
ignoresPersistentStateOnLaunch = "NO"
64+
debugDocumentVersioning = "YES"
65+
debugServiceExtension = "internal"
66+
allowLocationSimulation = "YES">
67+
</LaunchAction>
68+
<ProfileAction
69+
buildConfiguration = "Release"
70+
shouldUseLaunchSchemeArgsEnv = "YES"
71+
savedToolIdentifier = ""
72+
useCustomWorkingDirectory = "NO"
73+
debugDocumentVersioning = "YES">
74+
<MacroExpansion>
75+
<BuildableReference
76+
BuildableIdentifier = "primary"
77+
BlueprintIdentifier = "SwifterHlsMock"
78+
BuildableName = "SwifterHlsMock"
79+
BlueprintName = "SwifterHlsMock"
80+
ReferencedContainer = "container:">
81+
</BuildableReference>
82+
</MacroExpansion>
83+
</ProfileAction>
84+
<AnalyzeAction
85+
buildConfiguration = "Debug">
86+
</AnalyzeAction>
87+
<ArchiveAction
88+
buildConfiguration = "Release"
89+
revealArchiveInOrganizer = "YES">
90+
</ArchiveAction>
91+
</Scheme>

Example/main.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import SwifterHlsMock
2+
import Dispatch
3+
import Foundation
4+
5+
let server = HlsServer()
6+
7+
let semaphore = DispatchSemaphore(value: 0)
8+
do {
9+
try server.start(9080, forceIPv4: true)
10+
print("Server has started ( port = \(try server.port()) ). Try to connect now...")
11+
semaphore.wait()
12+
} catch {
13+
print("Server start error: \(error)")
14+
semaphore.signal()
15+
}

Package.resolved

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// swift-tools-version:5.3
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
let package = Package(
7+
name: "SwifterHlsMock",
8+
products: [
9+
.library(
10+
name: "SwifterHlsMock",
11+
targets: [
12+
"SwifterHlsMock"
13+
]
14+
),
15+
.executable(
16+
name: "Sample",
17+
targets: [
18+
"Sample"
19+
]
20+
)
21+
],
22+
dependencies: [
23+
.package(
24+
name: "Swifter",
25+
url: "https://github.com/httpswift/swifter.git",
26+
from: "1.5.0"
27+
)
28+
],
29+
targets: [
30+
.target(
31+
name: "SwifterHlsMock",
32+
dependencies: [
33+
.product(name: "Swifter", package: "Swifter")
34+
],
35+
resources: [
36+
.copy("Resources/segments")
37+
]
38+
),
39+
.target(
40+
name: "Sample",
41+
dependencies: [
42+
"SwifterHlsMock"
43+
],
44+
path: "Example"
45+
),
46+
.testTarget(
47+
name: "SwifterHlsMockTests",
48+
dependencies: ["SwifterHlsMock"]
49+
)
50+
]
51+
)
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)