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

play first video file #727

Closed
wants to merge 1 commit into from
Closed
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
7 changes: 2 additions & 5 deletions renderer/lib/torrent-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,11 @@ function isPlayableTorrent (torrentSummary) {

// Picks the default file to play from a list of torrent or torrentSummary files
// Returns an index or undefined, if no files are playable
// Play the first video file
function pickFileToPlay (files) {
// first, try to find the biggest video file
var videoFiles = files.filter(isVideo)
if (videoFiles.length > 0) {
var largestVideoFile = videoFiles.reduce(function (a, b) {
return a.length > b.length ? a : b
})
return files.indexOf(largestVideoFile)
return files.indexOf(videoFiles[0])
}

// if there are no videos, play the first audio file
Expand Down