Advertisement
Guest User

Untitled

a guest
May 23rd, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. //
  2. // AudioGuidance.swift
  3. // StyleAndFit
  4. //
  5. // Created by Nikolay Genov on 11/16/17.
  6. // Copyright © 2017 Programista; All rights reserved.
  7. //
  8.  
  9. import AVFoundation
  10.  
  11.  
  12. enum AudioGuidance: Int {
  13. case pressRecord
  14. case front
  15. case handsDown
  16. case handsUp
  17. case background
  18. case holdStill
  19. case three
  20. case two
  21. case one
  22. case takePhone
  23.  
  24. static let fileExtension = "mp3"
  25.  
  26. private var resources: [String] {
  27. switch self {
  28. case .pressRecord:
  29. return ["press_record"]
  30. case .front:
  31. return ["front","blank", "front_2","blank","front_3", "blank"]
  32. case .handsDown:
  33. return ["hands_down", "blank", "hands_down_2", "blank", "hands_down_3", "blank"]
  34. case .handsUp:
  35. return ["hands_up", "blank", "hands_up_2", "blank"]
  36. case .background:
  37. return ["move_out", "blank"]
  38. case .holdStill:
  39. return ["hold_still", "blank"]
  40. case .three:
  41. return ["3"]
  42. case .two:
  43. return ["2"]
  44. case .one:
  45. return ["1"]
  46. case .takePhone:
  47. #if B2C
  48. return ["take_phone_face"]
  49. #else
  50. return ["take_phone"]
  51. #endif
  52. }
  53. }
  54.  
  55. public var playerItems: [AVPlayerItem] {
  56. return resources
  57. .map { Bundle.main.url(forResource: $0, withExtension: AudioGuidance.fileExtension)! }
  58. .map { AVPlayerItem(url: $0) }
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement