Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: HLS 캐싱 적용 #350

Merged
merged 2 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions iOS/Layover/Layover.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
19AE482A2B2A127E00DD4612 /* HLSAssetResourceLoaderDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19AE48292B2A127E00DD4612 /* HLSAssetResourceLoaderDelegate.swift */; };
19AE482C2B2A1A8B00DD4612 /* HLSSliceResourceLoader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19AE482B2B2A1A8B00DD4612 /* HLSSliceResourceLoader.swift */; };
19AE482E2B2A24C700DD4612 /* URL+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19AE482D2B2A24C700DD4612 /* URL+.swift */; };
19AF2A062B5D06B9008C3620 /* HLSCachingServer in Frameworks */ = {isa = PBXBuildFile; productRef = 19AF2A052B5D06B9008C3620 /* HLSCachingServer */; };
19B665D92B4EEDDD0083E63C /* SignUpWorkerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19B665D52B4EEDDD0083E63C /* SignUpWorkerTests.swift */; };
19B665DA2B4EEDDD0083E63C /* SignUpInteractorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19B665D62B4EEDDD0083E63C /* SignUpInteractorTests.swift */; };
19B665DB2B4EEDDD0083E63C /* SignUpPresenterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19B665D72B4EEDDD0083E63C /* SignUpPresenterTests.swift */; };
Expand Down Expand Up @@ -531,6 +532,7 @@
buildActionMask = 2147483647;
files = (
194551FD2B0386D100299768 /* KakaoSDK in Frameworks */,
19AF2A062B5D06B9008C3620 /* HLSCachingServer in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -1286,6 +1288,7 @@
name = Layover;
packageProductDependencies = (
194551FC2B0386D100299768 /* KakaoSDK */,
19AF2A052B5D06B9008C3620 /* HLSCachingServer */,
);
productName = Layover;
productReference = FC7E45362AFEB623004F155A /* Layover.app */;
Expand Down Expand Up @@ -1340,6 +1343,7 @@
mainGroup = FC7E452D2AFEB623004F155A;
packageReferences = (
194551FB2B03863B00299768 /* XCRemoteSwiftPackageReference "kakao-ios-sdk" */,
19AF2A042B5D06B9008C3620 /* XCRemoteSwiftPackageReference "HLSCachingServer" */,
);
productRefGroup = FC7E45372AFEB623004F155A /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -1943,6 +1947,14 @@
kind = branch;
};
};
19AF2A042B5D06B9008C3620 /* XCRemoteSwiftPackageReference "HLSCachingServer" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/loinsir/HLSCachingServer";
requirement = {
branch = main;
kind = branch;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
Expand All @@ -1951,6 +1963,11 @@
package = 194551FB2B03863B00299768 /* XCRemoteSwiftPackageReference "kakao-ios-sdk" */;
productName = KakaoSDK;
};
19AF2A052B5D06B9008C3620 /* HLSCachingServer */ = {
isa = XCSwiftPackageProductDependency;
package = 19AF2A042B5D06B9008C3620 /* XCRemoteSwiftPackageReference "HLSCachingServer" */;
productName = HLSCachingServer;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = FC7E452E2AFEB623004F155A /* Project object */;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
"version" : "5.8.1"
}
},
{
"identity" : "hlscachingserver",
"kind" : "remoteSourceControl",
"location" : "https://github.com/loinsir/HLSCachingServer",
"state" : {
"branch" : "main",
"revision" : "968a67456b32d1ec889c60b826fd85b2fd6add39"
}
},
{
"identity" : "kakao-ios-sdk",
"kind" : "remoteSourceControl",
Expand All @@ -17,6 +26,33 @@
"branch" : "master",
"revision" : "5840447aabb9512d0ead90f672724e558731abc1"
}
},
{
"identity" : "swift-atomics",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-atomics.git",
"state" : {
"revision" : "cd142fd2f64be2100422d658e7411e39489da985",
"version" : "1.2.0"
}
},
{
"identity" : "swift-collections",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections.git",
"state" : {
"revision" : "d029d9d39c87bed85b1c50adee7c41795261a192",
"version" : "1.0.6"
}
},
{
"identity" : "swift-nio",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio.git",
"state" : {
"revision" : "702cd7c56d5d44eeba73fdf83918339b26dc855c",
"version" : "2.62.0"
}
}
],
"version" : 2
Expand Down
5 changes: 4 additions & 1 deletion iOS/Layover/Layover/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@

import UIKit
import KakaoSDKCommon
import HLSCachingServer

@main
class AppDelegate: UIResponder, UIApplicationDelegate {


private let hlsCachingServer = HLSCachingServer(urlSession: .shared, urlCache: .shared)

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

Expand All @@ -27,6 +28,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
setNavigationControllerAppearance()
setTabBarAppearance()

hlsCachingServer.start(port: 12345)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

포트번호는 그냥 무작위로 정해두신건가여?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넹 맞습니다

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

포트번호는 따로 보안 처리를 안해도 괜찮은건가요? 문득 궁금쓰

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

외부로 노출되는 백엔드 서버가 아니기에 보안 처리가 필요없다고 생각합니다.


return true
}

Expand Down
4 changes: 3 additions & 1 deletion iOS/Layover/Layover/Scenes/Playback/PlaybackView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import UIKit
import AVFoundation
import HLSCachingServer

final class PlaybackView: UIView {

Expand Down Expand Up @@ -106,7 +107,8 @@ final class PlaybackView: UIView {
// MARK: Player Setting Method

func addAVPlayer(url: URL) {
playerView.player = AVPlayer(url: url)
guard let reverseProxyURL = HLSCachingServer.reverseProxyURL(from: url) else { return }
playerView.player = AVPlayer(url: reverseProxyURL)
}

func getPlayerItemStatus() -> AVPlayerItem.Status? {
Expand Down