Merge branch 'master' into change_audio_tracks

This commit is contained in:
hicom150
2019-10-13 22:38:50 +02:00
10 changed files with 55 additions and 48 deletions

1
.github/FUNDING.yml vendored
View File

@@ -1,2 +1 @@
github: feross github: feross
custom: https://paypal.me/borewit

View File

@@ -142,11 +142,12 @@ The Windows app can be packaged from **any** platform.
Note: Windows code signing only works from **Windows**, for now. Note: Windows code signing only works from **Windows**, for now.
Note: To package the Windows app from non-Windows platforms, Note: To package the Windows app from non-Windows platforms,
[Wine](https://www.winehq.org/) needs to be installed. For example on Mac, first [Wine](https://www.winehq.org/) and [Mono](https://www.mono-project.com/) need
install [XQuartz](http://www.xquartz.org/), then run: to be installed. For example on Mac, first install
[XQuartz](http://www.xquartz.org/), then run:
``` ```
brew install wine brew install wine mono
``` ```
(Requires the [Homebrew](http://brew.sh/) package manager.) (Requires the [Homebrew](http://brew.sh/) package manager.)
@@ -164,7 +165,6 @@ If packaging from Mac, install system dependencies with Homebrew by running:
``` ```
npm run install-system-deps npm run install-system-deps
``` ```
#### Recommended readings to start working in the app #### Recommended readings to start working in the app
Electron (Framework to make native apps for Windows, OSX and Linux in Javascript): Electron (Framework to make native apps for Windows, OSX and Linux in Javascript):

6
package-lock.json generated
View File

@@ -5645,9 +5645,9 @@
} }
}, },
"music-metadata": { "music-metadata": {
"version": "4.5.3", "version": "4.8.0",
"resolved": "https://registry.npmjs.org/music-metadata/-/music-metadata-4.5.3.tgz", "resolved": "https://registry.npmjs.org/music-metadata/-/music-metadata-4.8.0.tgz",
"integrity": "sha512-VXIr9hGJyxcdyqOlUmn+c4wM8f1FAyLyxV12L1pYC5Zb/MKElrh2JmGTLBSy23DN27uBA4QbqhfOOtkvd9H6Mw==", "integrity": "sha512-eQp9mDTwg8WEqVRIEj1lUuqZ4qiQvXa71ipotkPFKch4ekTAtGTzU/TXAi7DhCeHsZB8WLfGUBTFN1NGBE1iOQ==",
"requires": { "requires": {
"content-type": "^1.0.4", "content-type": "^1.0.4",
"debug": "^4.1.0", "debug": "^4.1.0",

View File

@@ -31,7 +31,7 @@
"location-history": "^1.1.1", "location-history": "^1.1.1",
"material-ui": "^0.20.2", "material-ui": "^0.20.2",
"mkdirp": "^0.5.1", "mkdirp": "^0.5.1",
"music-metadata": "^4.5.3", "music-metadata": "^4.8.0",
"network-address": "^1.1.2", "network-address": "^1.1.2",
"parse-torrent": "^7.0.1", "parse-torrent": "^7.0.1",
"prettier-bytes": "^1.0.4", "prettier-bytes": "^1.0.4",
@@ -103,7 +103,7 @@
"install-system-deps": "brew install fakeroot dpkg rpm", "install-system-deps": "brew install fakeroot dpkg rpm",
"open-config": "node ./bin/open-config.js", "open-config": "node ./bin/open-config.js",
"package": "node ./bin/package.js", "package": "node ./bin/package.js",
"start": "npm run build && electron .", "start": "npm run build && electron --no-sandbox .",
"test": "standard && depcheck --ignores=standard,babel-eslint --ignore-dirs=build,dist && node ./bin/extra-lint.js", "test": "standard && depcheck --ignores=standard,babel-eslint --ignore-dirs=build,dist && node ./bin/extra-lint.js",
"test-integration": "npm run build && node ./test", "test-integration": "npm run build && node ./test",
"update-authors": "./bin/update-authors.sh", "update-authors": "./bin/update-authors.sh",

View File

@@ -25,7 +25,8 @@ function init () {
title: 'About ' + config.APP_WINDOW_TITLE, title: 'About ' + config.APP_WINDOW_TITLE,
useContentSize: true, useContentSize: true,
webPreferences: { webPreferences: {
nodeIntegration: true nodeIntegration: true,
enableBlinkFeatures: 'AudioVideoTracks'
}, },
width: 300 width: 300
}) })

View File

@@ -45,7 +45,7 @@ function init (state, options) {
width: initialBounds.width, width: initialBounds.width,
webPreferences: { webPreferences: {
nodeIntegration: true, nodeIntegration: true,
experimentalFeatures: true enableBlinkFeatures: 'AudioVideoTracks'
}, },
x: initialBounds.x, x: initialBounds.x,
y: initialBounds.y y: initialBounds.y

View File

@@ -26,7 +26,8 @@ function init () {
title: 'webtorrent-hidden-window', title: 'webtorrent-hidden-window',
useContentSize: true, useContentSize: true,
webPreferences: { webPreferences: {
nodeIntegration: true nodeIntegration: true,
enableBlinkFeatures: 'AudioVideoTracks'
}, },
width: 150 width: 150
}) })

View File

@@ -1,5 +1,3 @@
/* global HTMLMediaElement */
const React = require('react') const React = require('react')
const Bitfield = require('bitfield') const Bitfield = require('bitfield')
const prettyBytes = require('prettier-bytes') const prettyBytes = require('prettier-bytes')
@@ -137,7 +135,6 @@ function renderMedia (state) {
onError={dispatcher('mediaError')} onError={dispatcher('mediaError')}
onTimeUpdate={dispatcher('mediaTimeUpdate')} onTimeUpdate={dispatcher('mediaTimeUpdate')}
onEncrypted={dispatcher('mediaEncrypted')} onEncrypted={dispatcher('mediaEncrypted')}
onCanPlay={onCanPlay}
> >
{trackTags} {trackTags}
</MediaTagName> </MediaTagName>
@@ -155,29 +152,50 @@ function renderMedia (state) {
</div> </div>
) )
// As soon as we know the video dimensions, resize the window
function onLoadedMetadata (e) { function onLoadedMetadata (e) {
if (state.playing.type !== 'video') return const mediaElement = e.target
const video = e.target
const dimensions = { // check if we can decode video and audio track
width: video.videoWidth, if (state.playing.type === 'video') {
height: video.videoHeight if (mediaElement.videoTracks.length === 0) {
} dispatch('mediaError', 'Video codec unsupported')
dispatch('setDimensions', dimensions) }
if (mediaElement.audioTracks.length === 0) {
dispatch('mediaError', 'Audio codec unsupported')
}
dispatch('mediaSuccess')
const dimensions = {
width: mediaElement.videoWidth,
height: mediaElement.videoHeight
}
// As soon as we know the video dimensions, resize the window
dispatch('setDimensions', dimensions)
if (video.audioTracks) {
// set audioTracks // set audioTracks
const tracks = [] const tracks = []
for (let i = 0; i < video.audioTracks.length; i++) { for (let i = 0; i < mediaElement.audioTracks.length; i++) {
tracks.push({ tracks.push({
label: video.audioTracks[i].label || `Track ${i + 1}`, label: mediaElement.audioTracks[i].label || `Track ${i + 1}`,
language: video.audioTracks[i].language language: mediaElement.audioTracks[i].language
}) })
} }
state.playing.audioTracks.tracks = tracks state.playing.audioTracks.tracks = tracks
state.playing.audioTracks.selectedIndex = 0 state.playing.audioTracks.selectedIndex = 0
} }
// check if we can decode audio track
if (state.playing.type === 'audio') {
if (mediaElement.audioTracks.length === 0) {
dispatch('mediaError', 'Audio codec unsupported')
}
dispatch('mediaSuccess')
}
} }
function onEnded (e) { function onEnded (e) {
@@ -189,20 +207,6 @@ function renderMedia (state) {
if (state.window.isFullScreen) dispatch('toggleFullScreen') if (state.window.isFullScreen) dispatch('toggleFullScreen')
} }
} }
function onCanPlay (e) {
const elem = e.target
if (elem.readyState < HTMLMediaElement.HAVE_FUTURE_DATA) return
if (state.playing.type === 'video' &&
elem.webkitVideoDecodedByteCount === 0) {
dispatch('mediaError', 'Video codec unsupported')
} else if (elem.webkitAudioDecodedByteCount === 0) {
dispatch('mediaError', 'Audio codec unsupported')
} else {
dispatch('mediaSuccess')
elem.play()
}
}
} }
function renderOverlay (state) { function renderOverlay (state) {

View File

@@ -212,7 +212,9 @@ module.exports = class TorrentList extends React.Component {
else if (torrentSummary.progress.progress === 1) status = 'Not seeding' else if (torrentSummary.progress.progress === 1) status = 'Not seeding'
else status = 'Paused' else status = 'Paused'
} else if (torrentSummary.status === 'downloading') { } else if (torrentSummary.status === 'downloading') {
status = 'Downloading' if (!torrentSummary.progress) status = ''
else if (!torrentSummary.progress.ready) status = 'Verifying'
else status = 'Downloading'
} else if (torrentSummary.status === 'seeding') { } else if (torrentSummary.status === 'seeding') {
status = 'Seeding' status = 'Seeding'
} else { // torrentSummary.status is 'new' or something unexpected } else { // torrentSummary.status is 'new' or something unexpected
@@ -316,7 +318,7 @@ module.exports = class TorrentList extends React.Component {
torrentSummary.progress.files[index]) { torrentSummary.progress.files[index]) {
const fileProg = torrentSummary.progress.files[index] const fileProg = torrentSummary.progress.files[index]
isDone = fileProg.numPiecesPresent === fileProg.numPieces isDone = fileProg.numPiecesPresent === fileProg.numPieces
progress = Math.round(100 * fileProg.numPiecesPresent / fileProg.numPieces) + '%' progress = Math.floor(100 * fileProg.numPiecesPresent / fileProg.numPieces) + '%'
} }
// Second, for media files where we saved our position, show how far we got // Second, for media files where we saved our position, show how far we got

View File

@@ -5,7 +5,7 @@ Name=<%= productName %>
<% if (genericName) { %>GenericName=<%= genericName %><% } %> <% if (genericName) { %>GenericName=<%= genericName %><% } %>
<% if (description) { %>Comment=<%= description %><% } %> <% if (description) { %>Comment=<%= description %><% } %>
Icon=<%= name %> Icon=<%= name %>
<% if (name) { %>Exec=<%= name %> %U<% } %> <% if (name) { %>Exec=<%= name %> --no-sandbox %U<% } %><%/*HACK: --no-sandbox fixes an Electron 6 bug. See: #1703*/%>
Terminal=false Terminal=false
Actions=CreateNewTorrent;OpenTorrentFile;OpenTorrentAddress; Actions=CreateNewTorrent;OpenTorrentFile;OpenTorrentAddress;
<% if (mimeType && mimeType.length) { %>MimeType=<%= mimeType.join(';') %>;<% } %> <% if (mimeType && mimeType.length) { %>MimeType=<%= mimeType.join(';') %>;<% } %>
@@ -15,12 +15,12 @@ StartupNotify=true
[Desktop Action CreateNewTorrent] [Desktop Action CreateNewTorrent]
Name=Create New Torrent... Name=Create New Torrent...
<% if (name) { %>Exec=<%= name %> -n <% } %> <% if (name) { %>Exec=<%= name %> --no-sandbox -n <% } %><%/*HACK: --no-sandbox fixes an Electron 6 bug. See: #1703*/%>
[Desktop Action OpenTorrentFile] [Desktop Action OpenTorrentFile]
Name=Open Torrent File... Name=Open Torrent File...
<% if (name) { %>Exec=<%= name %> -o <% } %> <% if (name) { %>Exec=<%= name %> --no-sandbox -o <% } %><%/*HACK: --no-sandbox fixes an Electron 6 bug. See: #1703*/%>
[Desktop Action OpenTorrentAddress] [Desktop Action OpenTorrentAddress]
Name=Open Torrent Address... Name=Open Torrent Address...
<% if (name) { %>Exec=<%= name %> -u <% } %> <% if (name) { %>Exec=<%= name %> --no-sandbox -u <% } %><%/*HACK: --no-sandbox fixes an Electron 6 bug. See: #1703*/%>