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

Amanda/ui features #30

Open
wants to merge 9 commits into
base: pheonix
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 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
101 changes: 50 additions & 51 deletions KDIC/Base.lproj/Main_iPhone.storyboard

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions KDIC/Images.xcassets/Equalizer.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion KDIC/PlayerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,21 @@ class PlayerViewController: UIViewController {
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var subtitleLabel: UILabel!
@IBOutlet weak var imageView: UIImageView!

@IBAction func togglePlayerButtonWasTapped(_ sender: Any) {
KDICPlayer.toggle()
}

override func viewDidLoad() {
super.viewDidLoad()
self.imageView.image = UIImage(named: "Equalizer")
}

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
print("About to play")
KDICPlayer.play()
print("Playing!")
}

Copy link
Member

Choose a reason for hiding this comment

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

Nit: Extraneous newline.

}
9 changes: 6 additions & 3 deletions KDICCore/KDICPlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,28 @@ import AVFoundation

private let streamURL = URL(string: "http://kdic.grinnell.edu/stream")!

private(set) var isPlaying = false;
Copy link
Member

Choose a reason for hiding this comment

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

This should be in the class, like on line 9.


open class KDICPlayer {
private static var player: AVPlayer = {
let asset = AVURLAsset(url: streamURL)
let playerItem = AVPlayerItem(asset: asset)
let currentlyPlaying = isPlaying;
Copy link
Member

Choose a reason for hiding this comment

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

You never use this binding.

return AVPlayer(playerItem: playerItem)
}()

open static var isPlaying = player.rate != 0

open class func play() {
player.play()
isPlaying = true
}

open class func pause() {
player.pause()
isPlaying = false
}

open class func toggle() {
if isPlaying {
if isPlaying == true {
Copy link
Member

Choose a reason for hiding this comment

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

Must we use == here? Can't we just do if isPlaying?

Copy link
Member

Choose a reason for hiding this comment

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

Do we need to have == true here? Please remove if it compiles without it. isPlaying is a Bool.

pause()
} else {
play()
Expand Down