Skip to content
This repository has been archived by the owner on Jul 20, 2023. It is now read-only.

Adding Autoplay Switch: Issue #65 #66

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion Source/Jukebox.swift
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ open class Jukebox: NSObject, JukeboxItemDelegate {
}

// MARK:- Properties -
public var autoplay = true

fileprivate var player : AVPlayer?
fileprivate var progressObserver : AnyObject!
Expand Down Expand Up @@ -477,7 +478,7 @@ open class Jukebox: NSObject, JukeboxItemDelegate {
}

func playerItemDidPlayToEnd(_ notification : Notification){
if playIndex >= queuedItems.count - 1 {
if playIndex >= queuedItems.count - 1 || !autoplay {
stop()
} else {
play(atIndex: playIndex + 1)
Expand Down