Skip to content

Commit

Permalink
Resume playback when clicking a chapter
Browse files Browse the repository at this point in the history
  • Loading branch information
uiryuu committed Jan 30, 2019
1 parent 596390f commit 7c88b03
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
1 change: 1 addition & 0 deletions iina/PlayerCore.swift
Expand Up @@ -801,6 +801,7 @@ class PlayerCore: NSObject {
func playChapter(_ pos: Int) {
let chapter = info.chapters[pos]
mpv.command(.seek, args: ["\(chapter.time.second)", "absolute"])
togglePause(false)
// need to update time pos
syncUITime()
}
Expand Down
15 changes: 7 additions & 8 deletions iina/PlaylistViewController.swift
Expand Up @@ -439,16 +439,15 @@ class PlaylistViewController: NSViewController, NSTableViewDataSource, NSTableVi
let tv = notification.object as! NSTableView
if tv == playlistTableView {
showTotalLength()
return
}
guard tv.numberOfSelectedRows > 0 else { return }
if tv == chapterTableView {
let index = tv.selectedRow
player.playChapter(index)
let chapter = player.info.chapters[index]
tv.deselectAll(self)
tv.reloadData()
mainWindow.displayOSD(.chapter(chapter.title))
}
let index = tv.selectedRow
player.playChapter(index)
let chapter = player.info.chapters[index]
tv.deselectAll(self)
tv.reloadData()
mainWindow.displayOSD(.chapter(chapter.title))
}

func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
Expand Down

0 comments on commit 7c88b03

Please sign in to comment.