-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Playback audio file is no longer working #1320
Comments
I suspect the issue is caused in: webtorrent-desktop/src/renderer/webtorrent.js Lines 340 to 346 in b5bbd9b
Applying pull request #1240 resolves the cover art problem and does play the track, but the meta-data problem remains (...meta-data of the audio track to appear in the center of the window). I suspect there is an interoperability issue between the torrent stream and the library handling. Using the music-metadata module it possible, in addition to stream based reading, to use direct file access. If the file has completed downloading, that could be used instead: function getAudioMetadata (infoHash, index) {
const torrent = client.get(infoHash)
const file = torrent.files[index]
const options = {native: false, skipCovers: true}
const onMetaData = file.done
// If completed; use direct file access
? mm.parseFile(path.join(torrent.path, file.path), options)
// otherwise stream
: mm.parseStream(file.createReadStream(), file.name, options)
onMetaData
.then(function (metadata) {
console.log('got audio metadata for %s: %o', file.name, metadata)
ipc.send('wt-audio-metadata', infoHash, index, metadata)
}).catch(function (err) {
return console.log('error getting audio metadata for ' + infoHash + ':' + index, err)
})
} This fixes the meta-data of the audio track to appear in the center of the window if the file is completed: I know for for a fact that the old musicmetadata module, as used on the master branch, does not properly implement NodeJS streams. I have not been able able to figure out why the mm.parseStream no longer works with the music-metadata. I have a hard capturing breakpoints in the WebTorrent Hidden Window using IntelliJ. |
I think I got the lost issue (torrent-file-stream not working with music-metadata). I suspect it is caused by an error thrown in then-read-stream if (!(s instanceof stream.Readable)) {
throw new Error("Expected an instance of stream.Readable"); because webtorrent is using the readable-stream module. Bug reported against my own repo Borewit/peek-readable#4 |
with readable-stream module. Ref: issue #4 & webtorrent/webtorrent-desktop#1320
Update dependencies. Update then-read-stream to address issue webtorrent/webtorrent-desktop#1320
Had to adjust some Promise types and includes :-( Updated strtok3 should resolve issue webtorrent/webtorrent-desktop#1320
I manage to play audio tracks using the master branch code. I guess I made mistake somewhere switching between from my development branch back to the master branch. |
What version of WebTorrent Desktop? (See the 'About WebTorrent' menu)
Version 0.19.0 (0.98.21) (64-bit)
What operating system and version?
Microsoft Windows [Version 10.0.16299.192]
What did you do?
What did you expect to happen?
I would expect:
What actually happened?
The text was updated successfully, but these errors were encountered: