95 lines
2.9 KiB
Swift
95 lines
2.9 KiB
Swift
//
|
|
// VideoInstrictionsViewController.swift
|
|
// Guibe
|
|
//
|
|
// Created by Max Hunt on 02/06/2019.
|
|
// Copyright © 2019 8. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
import AVKit
|
|
|
|
class VideoInstrictionsViewController: UIViewController, AVAudioPlayerDelegate {
|
|
|
|
|
|
@IBOutlet weak var tuturialBtn: UIButton!
|
|
@IBOutlet weak var setupBtn: UIButton!
|
|
@IBOutlet weak var backBtn: UIButton!
|
|
|
|
@IBAction func backBtnPressed(_ sender: Any) {
|
|
self.dismiss(animated: true, completion: nil)
|
|
}
|
|
|
|
@IBAction func tutorialBtnPressed(_ sender: Any) {
|
|
playVideo1()
|
|
}
|
|
|
|
@IBAction func setupBtnPressed(_ sender: Any) {
|
|
playVideo2()
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
|
|
tuturialBtn.layer.shadowColor = UIColor.black.cgColor
|
|
tuturialBtn.layer.cornerRadius = 9
|
|
tuturialBtn.layer.shadowOffset = CGSize(width: 7, height: 9)
|
|
tuturialBtn.layer.shadowRadius = 9
|
|
tuturialBtn.layer.shadowOpacity = 0.4
|
|
|
|
setupBtn.layer.shadowColor = UIColor.black.cgColor
|
|
setupBtn.layer.cornerRadius = 9
|
|
setupBtn.layer.shadowOffset = CGSize(width: 7, height: 9)
|
|
setupBtn.layer.shadowRadius = 9
|
|
setupBtn.layer.shadowOpacity = 0.4
|
|
|
|
backBtn.accessibilityLabel = "Back"
|
|
tuturialBtn.accessibilityLabel = "Usage Tutorial"
|
|
setupBtn.accessibilityLabel = "Guibe bracelet setup tutorial"
|
|
|
|
// Do any additional setup after loading the view.
|
|
}
|
|
|
|
private func playVideo1() {
|
|
guard let path = Bundle.main.path(forResource: "placeholder", ofType:"mp4") else {
|
|
debugPrint("404")
|
|
return }
|
|
let player = AVPlayer(url: URL(fileURLWithPath: path))
|
|
let playerController = AVPlayerViewController()
|
|
playerController.player = player
|
|
// playerController.modalPresentationStyle = .popover
|
|
present(playerController, animated: true) {
|
|
player.play()
|
|
}
|
|
}
|
|
|
|
private func playVideo2() {
|
|
guard let path = Bundle.main.path(forResource: "placeholder", ofType:"mp4") else {
|
|
debugPrint("404")
|
|
return }
|
|
let player = AVPlayer(url: URL(fileURLWithPath: path))
|
|
let playerController = AVPlayerViewController()
|
|
playerController.player = player
|
|
// playerController.modalPresentationStyle = .popover
|
|
present(playerController, animated: true) {
|
|
player.play()
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
// MARK: - Navigation
|
|
|
|
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
|
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
|
|
// Get the new view controller using segue.destination.
|
|
// Pass the selected object to the new view controller.
|
|
}
|
|
*/
|
|
|
|
}
|