Skip to content

Commit

Permalink
Merge pull request #8 from sxudan/main
Browse files Browse the repository at this point in the history
Research Update
  • Loading branch information
sxudan authored Mar 11, 2024
2 parents 598fa38 + 81471e7 commit bcebb05
Show file tree
Hide file tree
Showing 18 changed files with 1,146 additions and 764 deletions.
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,28 @@ let audioFileDescriptor = open(audioPipe!, O_RDWR)
This worked very well!!


# Usage

```Swift
let cameraSource = CameraSource(position: .front)
let microphoneSource = MicrophoneSource()
let ffLiveKit = FFLiveKit()
```

```Swift
try? ffLiveKit.connect(connection: RTMPConnection(baseUrl: "rtmp://192.168.1.100:1935"))
ffLiveKit.addSource(camera: cameraSource, microphone: microphoneSource)
cameraSource.startPreview(previewView: self.view)
ffLiveKit.prepare(delegate: self)
```

```Swift
if !isRecording {
try? ffLiveKit.publish(name: "mystream")
} else {
ffLiveKit.stop()
}
```

# Demo

Expand All @@ -113,6 +135,5 @@ https://private-user-images.githubusercontent.com/31989781/311260826-f0fa60e3-41
# TODO

- CPU Optimization
- Continue live streaming when app is put in background (Audio)


88 changes: 70 additions & 18 deletions live-demo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,39 @@

/* Begin PBXBuildFile section */
7830AB979939E8876AC5B5CF /* Pods_live_demo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B46632C18825C406E474741D /* Pods_live_demo.framework */; };
D30E1B0A2B9A9F2600D78458 /* LiveFeedController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D30E1B092B9A9F2600D78458 /* LiveFeedController.swift */; };
D30E1B0E2B9AA30100D78458 /* CameraUtility.swift in Sources */ = {isa = PBXBuildFile; fileRef = D30E1B0D2B9AA30100D78458 /* CameraUtility.swift */; };
D30E1B102B9AAC2000D78458 /* StreamPublisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = D30E1B0F2B9AAC2000D78458 /* StreamPublisher.swift */; };
D30E1B122B9D607E00D78458 /* Connection.swift in Sources */ = {isa = PBXBuildFile; fileRef = D30E1B112B9D607E00D78458 /* Connection.swift */; };
D30E1B152B9D60A400D78458 /* RTMPConnection.swift in Sources */ = {isa = PBXBuildFile; fileRef = D30E1B142B9D60A400D78458 /* RTMPConnection.swift */; };
D30E1B172B9D60B200D78458 /* RTSPConnection.swift in Sources */ = {isa = PBXBuildFile; fileRef = D30E1B162B9D60B200D78458 /* RTSPConnection.swift */; };
D30E1B1D2B9D639800D78458 /* CameraSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = D30E1B1C2B9D639800D78458 /* CameraSource.swift */; };
D30E1B1F2B9D666F00D78458 /* TestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D30E1B1E2B9D666F00D78458 /* TestViewController.swift */; };
D30E1B212B9D6A3700D78458 /* MicrophoneSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = D30E1B202B9D6A3700D78458 /* MicrophoneSource.swift */; };
D30E1B242B9D6B5F00D78458 /* BufferConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = D30E1B232B9D6B5F00D78458 /* BufferConverter.swift */; };
D30E1B262B9D6E3B00D78458 /* FFLiveKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = D30E1B252B9D6E3B00D78458 /* FFLiveKit.swift */; };
D30E1B282B9D914C00D78458 /* FFmpegUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = D30E1B272B9D914C00D78458 /* FFmpegUtils.swift */; };
D30E1B2A2B9DEBFA00D78458 /* Source.swift in Sources */ = {isa = PBXBuildFile; fileRef = D30E1B292B9DEBFA00D78458 /* Source.swift */; };
D30E1B2C2B9DEFC100D78458 /* FileSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = D30E1B2B2B9DEFC100D78458 /* FileSource.swift */; };
D3A2572D2B8BFD2800B69B54 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3A2572C2B8BFD2800B69B54 /* AppDelegate.swift */; };
D3A2572F2B8BFD2800B69B54 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3A2572E2B8BFD2800B69B54 /* SceneDelegate.swift */; };
D3A257312B8BFD2800B69B54 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3A257302B8BFD2800B69B54 /* ViewController.swift */; };
D3A257342B8BFD2800B69B54 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D3A257322B8BFD2800B69B54 /* Main.storyboard */; };
D3A257362B8BFD2900B69B54 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D3A257352B8BFD2900B69B54 /* Assets.xcassets */; };
D3A257392B8BFD2900B69B54 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D3A257372B8BFD2900B69B54 /* LaunchScreen.storyboard */; };
D3B4D7002B994E61001CFE6B /* Helper.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3B4D6FF2B994E61001CFE6B /* Helper.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
17AE0299CEBC43D9EFBBEE6D /* Pods-live-demo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-live-demo.release.xcconfig"; path = "Target Support Files/Pods-live-demo/Pods-live-demo.release.xcconfig"; sourceTree = "<group>"; };
B46632C18825C406E474741D /* Pods_live_demo.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_live_demo.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D30E1B092B9A9F2600D78458 /* LiveFeedController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LiveFeedController.swift; sourceTree = "<group>"; };
D30E1B0D2B9AA30100D78458 /* CameraUtility.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CameraUtility.swift; sourceTree = "<group>"; };
D30E1B0F2B9AAC2000D78458 /* StreamPublisher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StreamPublisher.swift; sourceTree = "<group>"; };
D30E1B112B9D607E00D78458 /* Connection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Connection.swift; sourceTree = "<group>"; };
D30E1B142B9D60A400D78458 /* RTMPConnection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RTMPConnection.swift; sourceTree = "<group>"; };
D30E1B162B9D60B200D78458 /* RTSPConnection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RTSPConnection.swift; sourceTree = "<group>"; };
D30E1B1C2B9D639800D78458 /* CameraSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CameraSource.swift; sourceTree = "<group>"; };
D30E1B1E2B9D666F00D78458 /* TestViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestViewController.swift; sourceTree = "<group>"; };
D30E1B202B9D6A3700D78458 /* MicrophoneSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MicrophoneSource.swift; sourceTree = "<group>"; };
D30E1B232B9D6B5F00D78458 /* BufferConverter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BufferConverter.swift; sourceTree = "<group>"; };
D30E1B252B9D6E3B00D78458 /* FFLiveKit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FFLiveKit.swift; sourceTree = "<group>"; };
D30E1B272B9D914C00D78458 /* FFmpegUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FFmpegUtils.swift; sourceTree = "<group>"; };
D30E1B292B9DEBFA00D78458 /* Source.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Source.swift; sourceTree = "<group>"; };
D30E1B2B2B9DEFC100D78458 /* FileSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileSource.swift; sourceTree = "<group>"; };
D3A257292B8BFD2800B69B54 /* live-demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "live-demo.app"; sourceTree = BUILT_PRODUCTS_DIR; };
D3A2572C2B8BFD2800B69B54 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
D3A2572E2B8BFD2800B69B54 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
Expand All @@ -34,7 +49,6 @@
D3A257352B8BFD2900B69B54 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
D3A257382B8BFD2900B69B54 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
D3A2573A2B8BFD2900B69B54 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
D3B4D6FF2B994E61001CFE6B /* Helper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Helper.swift; sourceTree = "<group>"; };
E713281D99B7811BD664DE09 /* Pods-live-demo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-live-demo.debug.xcconfig"; path = "Target Support Files/Pods-live-demo/Pods-live-demo.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand All @@ -61,17 +75,48 @@
D30E1B0B2B9AA2C100D78458 /* Controllers */ = {
isa = PBXGroup;
children = (
D30E1B092B9A9F2600D78458 /* LiveFeedController.swift */,
D30E1B1E2B9D666F00D78458 /* TestViewController.swift */,
);
path = Controllers;
sourceTree = "<group>";
};
D30E1B0C2B9AA2EC00D78458 /* Utils */ = {
D30E1B132B9D608A00D78458 /* Source */ = {
isa = PBXGroup;
children = (
D3B4D6FF2B994E61001CFE6B /* Helper.swift */,
D30E1B0D2B9AA30100D78458 /* CameraUtility.swift */,
D30E1B0F2B9AAC2000D78458 /* StreamPublisher.swift */,
D30E1B222B9D6B4A00D78458 /* Utils */,
D30E1B192B9D61B300D78458 /* IO */,
D30E1B182B9D61A900D78458 /* Net */,
D30E1B252B9D6E3B00D78458 /* FFLiveKit.swift */,
);
path = Source;
sourceTree = "<group>";
};
D30E1B182B9D61A900D78458 /* Net */ = {
isa = PBXGroup;
children = (
D30E1B112B9D607E00D78458 /* Connection.swift */,
D30E1B142B9D60A400D78458 /* RTMPConnection.swift */,
D30E1B162B9D60B200D78458 /* RTSPConnection.swift */,
);
path = Net;
sourceTree = "<group>";
};
D30E1B192B9D61B300D78458 /* IO */ = {
isa = PBXGroup;
children = (
D30E1B1C2B9D639800D78458 /* CameraSource.swift */,
D30E1B292B9DEBFA00D78458 /* Source.swift */,
D30E1B202B9D6A3700D78458 /* MicrophoneSource.swift */,
D30E1B2B2B9DEFC100D78458 /* FileSource.swift */,
);
path = IO;
sourceTree = "<group>";
};
D30E1B222B9D6B4A00D78458 /* Utils */ = {
isa = PBXGroup;
children = (
D30E1B232B9D6B5F00D78458 /* BufferConverter.swift */,
D30E1B272B9D914C00D78458 /* FFmpegUtils.swift */,
);
path = Utils;
sourceTree = "<group>";
Expand Down Expand Up @@ -105,7 +150,7 @@
D3A257372B8BFD2900B69B54 /* LaunchScreen.storyboard */,
D3A2573A2B8BFD2900B69B54 /* Info.plist */,
D30E1B0B2B9AA2C100D78458 /* Controllers */,
D30E1B0C2B9AA2EC00D78458 /* Utils */,
D30E1B132B9D608A00D78458 /* Source */,
);
path = "live-demo";
sourceTree = "<group>";
Expand Down Expand Up @@ -234,13 +279,20 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
D30E1B212B9D6A3700D78458 /* MicrophoneSource.swift in Sources */,
D3A257312B8BFD2800B69B54 /* ViewController.swift in Sources */,
D30E1B2C2B9DEFC100D78458 /* FileSource.swift in Sources */,
D30E1B282B9D914C00D78458 /* FFmpegUtils.swift in Sources */,
D3A2572D2B8BFD2800B69B54 /* AppDelegate.swift in Sources */,
D30E1B262B9D6E3B00D78458 /* FFLiveKit.swift in Sources */,
D3A2572F2B8BFD2800B69B54 /* SceneDelegate.swift in Sources */,
D30E1B0A2B9A9F2600D78458 /* LiveFeedController.swift in Sources */,
D3B4D7002B994E61001CFE6B /* Helper.swift in Sources */,
D30E1B102B9AAC2000D78458 /* StreamPublisher.swift in Sources */,
D30E1B0E2B9AA30100D78458 /* CameraUtility.swift in Sources */,
D30E1B122B9D607E00D78458 /* Connection.swift in Sources */,
D30E1B1F2B9D666F00D78458 /* TestViewController.swift in Sources */,
D30E1B172B9D60B200D78458 /* RTSPConnection.swift in Sources */,
D30E1B152B9D60A400D78458 /* RTMPConnection.swift in Sources */,
D30E1B242B9D6B5F00D78458 /* BufferConverter.swift in Sources */,
D30E1B1D2B9D639800D78458 /* CameraSource.swift in Sources */,
D30E1B2A2B9DEBFA00D78458 /* Source.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Loading

0 comments on commit bcebb05

Please sign in to comment.