Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/developeracademy-postech/2024-nc2-a30-video
SNOOQ
https://github.com/developeracademy-postech/2024-nc2-a30-video
Last synced: about 10 hours ago
JSON representation
SNOOQ
- Host: GitHub
- URL: https://github.com/developeracademy-postech/2024-nc2-a30-video
- Owner: DeveloperAcademy-POSTECH
- Created: 2024-06-19T08:14:34.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-06-20T23:15:19.000Z (5 months ago)
- Last Synced: 2024-06-21T18:27:59.461Z (5 months ago)
- Language: Swift
- Size: 158 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 2024-NC2-A30-Video
![NC2 Slide 16_9 (1)](https://github.com/DeveloperAcademy-POSTECH/2024-NC2-A30-Video/assets/71865277/0787f073-6a79-4014-9f36-a838d4e0a444)## π₯ Youtube Link
(μΆν λ§λ€μ΄μ§ μ νλΈ λ§ν¬ μΆκ°)
## π‘ About Video
- μμμ λ€λ£¨λ Videoμ μ΄λ€ κΈ°μ λ€μ΄ μλμ§ μκ² λμλ€.
- AVKitμ νμ©νλ©΄ μλ§, μΊ‘μ , μλ μ‘°μ λ±μ κΈ°λ₯μ κ°μ§ Media Playback(μμ νλ μ΄μ΄)κ³Ό PiP(Picture in Picture)λ₯Ό ꡬνν μ μλ€λ κ²μ μκ² λμλ€.
- AVKitμ AVPlayerμ AVPlayerViewControllerλ₯Ό νμ©ν΄μ νλ μ΄μ΄λ₯Ό ꡬνν μ μκ² λμλ€.
## π― What I focus on?
- ARKitμ νμ©νμ¬ ARSessionκ³Ό EyeTrackingμ ν΅ν©
- AVKitμ μ΄μ©ν΄ λμμ νλ μ΄μ΄λ₯Ό ꡬν
- μ¬μ©μμ λ μμ§μκ³Ό λ κΉλ°μμ κ°μ§νμ¬ μμμ μ μ΄νλ κΈ°μ μ μ€μ μ μΌλ‘ λ€λ£Έ
## πΌ Use Case
> μ¬μ©μκ° μ€λ₯Έμͺ½μΌλ‘ λμ μμ§μ΄λ©΄ μλμΌλ‘ λ€μ λμμμ΄ μ¬μλλ©°, λ κΉλ°μμ κ°μ§νμ¬ μΌμμ μ§ λλ μ¬μμ μ μ΄ν μ μλ€.
- μ리 μ€μ΄κ±°λ, ννΈλ₯Ό νκ±°λ, νκΈ°νλ©΄μ μμμ λ³Ό λμ κ°μ μν©μμ μ μ©ν¨
- μμ΄ λΆνΈν μ¬λλ€μ΄ νΈμ¦ν리 컨νΈλ‘€μ μ½κ² ν μ μλλ‘ λμΈ μ μμ
## πΌοΈ Prototype
![NC2 Mockups](https://github.com/DeveloperAcademy-POSTECH/2024-NC2-A30-Video/assets/71865277/a6c117e4-c9ed-4b9f-acf1-c8b20432f512)
- λ©μΈ νλ©΄μμ κ°λ¨ν μ¨λ³΄λ© 문ꡬλ₯Ό νμΈν μ μλ€.
- **μμνκΈ°** λ²νΌμ λλ¬ μμ μμ²μ μμνλ€.
- μμμ μκ°μ΄ λ€ λλ©΄ λ€μ μμμΌλ‘ μλμΌλ‘ λμ΄κ°λ€.
- λ€λ§ μ€κ°μ λ€μ μμμΌλ‘ μ΄λνκ³ μΆμ κ²½μ°, λμΉλ₯Ό λ³΄λ― π **μ€λ₯Έμͺ½ λμΌλ‘ μμ μ λμλ€ λμμ€λ©΄** λ€μμΌλ‘ λκΈΈ μ μλ€.
## π οΈ About Code
μ΄λ² νλ‘μ νΈμμλ AVKitκ³Ό ARKitμ νμ©νμ¬ μ¬μ©μμ λ μμ§μκ³Ό κΉλ°μμΌλ‘ μμμ μ μ΄νλ κΈ°λ₯μ ꡬννλ€.### AVKitμ νμ©ν λμμ νλ μ΄μ΄ ꡬν
**AVPlayerμ AVPlayerViewController μ€μ **
```swift
var player: AVPlayer?
var playerController: AVPlayerViewController?
@objc func playVideo() {
guard currentVideoIndex < videos.count else {
currentVideoIndex = 0
return
}
let videoName = videos[currentVideoIndex]
guard let path = Bundle.main.path(forResource: videoName, ofType: "mp4") else {
debugPrint("MP4 Not Found")
return
}
let url = URL(fileURLWithPath: path)
let playerItem = AVPlayerItem(url: url)
NotificationCenter.default.addObserver(self, selector: #selector(videoDidEnd), name: .AVPlayerItemDidPlayToEndTime, object: playerItem)
player = AVPlayer(playerItem: playerItem)
playerController = AVPlayerViewController()
playerController?.player = player
present(playerController!, animated: true) {
self.player?.play()
}
startSession()
}
```### ARKitκ³Ό EyeTrackingμ ν΅ν λ μμ§μ κ°μ§
**μΈμ μ€μ λ° μμ**
```swift
func setupARSession() {
session = ARSession()
session.delegate = self
let configuration = ARFaceTrackingConfiguration()
configuration.isLightEstimationEnabled = true
session.run(configuration, options: [])
}@objc func startSession() {
eyeTracking?.startSession()
eyeTracking?.showPointer()
let configuration = ARFaceTrackingConfiguration()
configuration.isLightEstimationEnabled = true
session.run(configuration, options: [])
}@objc func endSession() {
eyeTracking?.hidePointer()
eyeTracking?.endSession()
session.pause()
}
```**λ μμ§μμ ν΅ν λμμ μ μ΄**
```swift
@objc func checkGazePosition() {
guard let currentSession = eyeTracking?.currentSession, let lastGaze = currentSession.scanPath.last else { return }
if lastGaze.x < 0 {
print("Gaze exited to the right")
endSession()
playNextVideo()
}
}
```