When manually adding subtitle track(s), always switch to a new track

Also fix a bug I added in the parent commit
This commit is contained in:
DC
2016-05-16 08:41:02 -07:00
parent eeda7c17c5
commit d466ed085a
2 changed files with 7 additions and 3 deletions

View File

@@ -423,6 +423,8 @@ function openSubtitles () {
properties: [ 'openFile' ]
}, function (filenames) {
if (!Array.isArray(filenames)) return
// autoselect the newly added subtitle tracks
state.playing.subtitles.selectedIndex = -1
addSubtitle({path: filenames[0]}, true)
})
}
@@ -543,6 +545,8 @@ function onOpen (files) {
// In the player, the only drag-drop function is adding subtitles
var isInPlayer = state.location.current().url === 'player'
if (isInPlayer) {
// always autoselect one of the newly added subtitle tracks
state.playing.subtitles.selectedIndex = -1
return files.filter(isSubtitle).forEach((file) => addSubtitle(file, true))
}