-
-
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
Improve codec unsupported detection #1711
Improve codec unsupported detection #1711
Conversation
Wow, can it really be this simple? If this actually works better, let's merge it. Haven't had time to test it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @hicom150. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the changes done! 👍
src/renderer/pages/player-page.js
Outdated
}) | ||
.then( | ||
() => dispatch('mediaSuccess'), | ||
() => dispatch('mediaError', 'Codec unsupported') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe?
.then(
() => dispatch('mediaSuccess'),
err => dispatch('mediaError', err.name === 'NotSupportedError' ? 'Codec unsupported' : `${err.name}: ${err.message}`)
)
I put it on a branch: https://github.com/webtorrent/webtorrent-desktop/tree/issue-1711-improve-error-handling
For some reason I would send PR to your clone, I think select your fork as the base. Maybe a bug in GitHub, to many forks of this repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that we should dispatch mediaError
when error type is NotSupportedError
(original code) or when any error case (like the latest code change).
Given that the possible exceptions are NotSupportedError
or NotAllowedError
I wouldn't show this last one to the final user 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't show this last one to the final user
why not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It also says other exceptions may be reported,. I suppose these are not very likely to be thrown, but it may be good user gets an error if something odd happens.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the current code, in the unlikely event of an error named NotAllowedError
, or any other exception, it will prompt the user with 'Codec unsupported' right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the current code, in the unlikely event of an error named NotAllowedError, or any other exception, it will prompt the user with 'Codec unsupported' right?
Yes that is right 😅 Although it is not 100% correct for the final user, the action should be the same: open an external player to be able to play the file, otherwise it would see the message The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.
which I found a bit confusing for the user as it doesn't give any "call to action" to solve the problem.
On the other hand, it is true that we should log the proper error code, so we can debug future problems easily 😉
What do you think @Borewit ?
…/webtorrent-desktop into fix_codec_unsupported_detection
I believe the current implementation using the audio/video api for manage this flow is ok, I tried in the past use this approach but I ended up leaving as is because it seems wiser anyways this pr looks simple. I would like to add some details I found. I put a console.log, to see that element as a lot of times is throwing me a false positive
Both are mp3's so im not sure if this |
With the current implementation we get false positives as described in #1668
Why? If you had an issue with PR approach, is that still valid? Can you test the PR @RecoX ? Or do you advice to merge, it is not clear to me.
Looks very clean and simple indeed. |
As there is some discussion, I suggest to keep the PR open for 2 day. Please use the review process fellow contributors. Sorry for the delay @hicom150. |
I tested it and it works ok, but I found a problem. When I tried to reproduce a here the link of the file where i implement it just in case you want to take a look. btw im using this patch in the meantime.
|
You don't see them because i didn't push the changes, probably is because the player in my fork is in the main window instead of the player window. Anyways is strange that occurs to me with the new code and with the older no. |
Video with AC3 audio plays silently (like Chrome), and does not give the user the option to open in an external player. |
Ups! I didn't expect that result 😓 In order to help the debugging process can we share the test files where we get the unexpected behaviors? @mathiasvr @RecoX Here I share the some files a what should be the expected result:
|
@hicom150 I just went ahead and generated a bunch of different samples with various video/audio codecs, because why not? 😃 https://drive.google.com/open?id=1ACw6hOooQNfc-oniyL0Gp-z4OSq-5Mc7 Before this PR, a supported video file (such as h264) with AC3 audio codec displays 'Audio codec not supported', and after this PR it plays the video with audio muted. It would be nice if we could still detect unsupported audio. |
After some further testing with the awesome @mathiasvr video samples 😉 it seems that So unless someone comes with a better solution, I think that the only proper option is to try to optimize the previous |
Agreed :) +1 |
@hicom150 Did you see other problems than muted audio? Otherwise I think the |
I changed the approach and instead of using Having this, I see two options:
To sum up, the advantage of this method is that we can check available tracks early in |
Nice work @hicom150! |
I feel its too hacky too. If we can't play the video as we should we simply can offer to open it with a an external player and that's it. Keep it simple. |
After some back and forth I think that finally I'm going to merge this PR a go forward 😉 |
What is the purpose of this pull request? (put an "X" next to item)
[ ] Documentation update
[x] Bug fix
[ ] New feature
[ ] Other, please explain:
What changes did you make? (Give an overview)
It seems that from time to time we get some "codec unsupported" false positive. This PR changes unsupported codec detection to use
HTMLMediaElement.play() Promise
based on what it is explained in this article.Is there anything you'd like reviewers to focus on?
Check that we don't get false positives caused by timing issues.