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

[Bug] v.redd.it video files: No webm source file found #5

Closed
rom-1 opened this issue Apr 10, 2021 · 6 comments
Closed

[Bug] v.redd.it video files: No webm source file found #5

rom-1 opened this issue Apr 10, 2021 · 6 comments
Labels
bug Something isn't working

Comments

@rom-1
Copy link
Contributor

rom-1 commented Apr 10, 2021

When embedding video content from v.redd.it, there are currently 2 source urls used: one for .webm and one for a .mp4 file.
Example code:

<div class="reddit-image figure">
    <video controls="" preload="metadata" class="reddit-image">
        <source src="https://v.redd.it/g5xu53hv97s61/DASH_720.webm" type="video/webm">
        <source src="https://v.redd.it/g5xu53hv97s61/DASH_720.mp4" type="video/mp4">
    </video>
</div>

While this works for some media platforms, e.g. gfycat.com, it does not work with v.redd.it, as this platform is simply not offering a .webm file. This means currently there is a broken link as a source file referenced, and some 3rd party clients throw an error in this case. A clean solution would be to only reference the mp4 file.

See #4 for additional information

aledeg added a commit that referenced this issue Apr 10, 2021
Before, the process was adding both a source for webm and mp4 videos. But this
was an issue since not every source provide the 2 formats. Thus making the
rendering quite unusable when in third-party tools.
Now, the mp4 format is preferred. On top of that the URL is checked before being
added to the video tag. It's a bit longer to process but it's much safer since
all URL are validated beforehand.

See #5
@aledeg
Copy link
Owner

aledeg commented Apr 10, 2021

@rom-1 I've made a fix. It's not released yet but you can still try it out. Let me know if it works the way you've intended. Thank you!

@rom-1
Copy link
Contributor Author

rom-1 commented Apr 11, 2021

@aledeg I gave it a shot, seems to work flawless. I had no chance to test it with other sources then v.redd.it, as nowadays 99% of reddits media content seems to come from there. But all these videos are now showing up in my RSS Reader app without any problems. Before they had an error "source not found". Thank you very much. :)

@aledeg
Copy link
Owner

aledeg commented Apr 11, 2021

Good! Did you notice if loading is longer?
I've changed the rendering to ease the validation and I've added some http validation. It should take more time to render but I haven't feel it with my test sample.

@rom-1
Copy link
Contributor Author

rom-1 commented Apr 11, 2021

Yea, I took a look at the source code you changed, and already saw that you are now checking for the http status return code before building the html source code. While this approach is promising to be very low-maintenance (peu d'entretien?), it should naturally increase loading times. But I agree, it is barely noticeable, so this works for me. Thanks a lot! :)

// Side Note - Offtopic
To avoid the additional http request, I guess the only other solution I can think of would be to implement an associative array / hashtable as a constant for every possible source used on reddit.com. So by checking for the source url domain name, apply the correct handling.
Example:
$contentURL['gifycat']='video/webm';
$contentURL['v.redd.it']='video/mp4';
$contentURL['i.redd.it']='gif';
$contentURL['imgur']='etcetc';

To be honest, I am afraid in the future you might not be able avoid this manual approach, as there might be other sources which require special handling, or might need specially crafted source urls. I know your extension is focusing on image handling, but you are also displaying other content types like gifs, text and videos from external sources (which is great! 😀).
Just one example: It might already be debatable for this example post if it would technically not be better to embed the mp4 video source (147KB) instead of the huge gif file (15.6MB) which is happening right now.... but this would need source url specific handling.

// Side Note 2 - very offtopic
Just tell me to bug off if I am getting on your nerves, please. :)
On the plus side, you are not the only one today who gets new issues created by me regarding reddit media and FreshRSS 😂

@aledeg
Copy link
Owner

aledeg commented Apr 11, 2021

I am afraid I will someday do something similar to what you've mentioned. I not eager to do it though.

You're not getting on my nerves. But thank you for asking.
Actually, I find it quite rewarding that someone is using the code I've started as a quick hack. It becomes better with each iteration (At least, I hope).

@aledeg
Copy link
Owner

aledeg commented Apr 27, 2021

@aledeg aledeg closed this as completed Apr 27, 2021
@aledeg aledeg added the bug Something isn't working label Apr 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants