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

Get video URLs in Wagtail API #16

Closed
fabienheureux opened this issue Jan 10, 2017 · 5 comments
Closed

Get video URLs in Wagtail API #16

fabienheureux opened this issue Jan 10, 2017 · 5 comments

Comments

@fabienheureux
Copy link

Hi,

Sorry to ask something maybe dumb or already done, but I was wondering if it was possible to get the video url directly into API results for a content ?

I was able (with some help from wagtaildemo repo and wagtail documentation) to setup something similar for images, but this app seems (obviously) a bit different.
Do you guys could have an idea about how to achieve this ?

I did the following for images: http://docs.wagtail.io/en/v1.8/advanced_topics/images/image_serve_view.html#generating-dynamic-image-urls-in-python

I did look into the wagtailvideos code, but didn't find such a function (and it is a bit more complicated with various transcoded versions). As you could understand, I am quite new to django/wagtail universe, so sorry again if this is a dumb question.

Thanks a lot in advance
(and thanks @TakeFlight for the work done on every wagtail apps, almost each one really rocks !)

Regards
Fab

@fabienheureux
Copy link
Author

I thought of trying to implement this: https://github.com/wagtail/wagtail/blob/master/wagtail/wagtailimages/views/serve.py into wagtailvideos, will update if I get something :)

@mx-moth
Copy link
Collaborator

mx-moth commented Jan 20, 2017

I don't have much experience with the Wagtail API, but it will not have to be integrated in the same way as wagtailimages. The complicating factor with wagtailimages is the resizing step - allowing people to resize any image with any filter would open a potential DDoS vector. The same is not true of wagtailvideos, as all the transcoding is done in a separate process. The URL of the video file should be accessible as video.file.url, and for each of the transcoded videos with something like:

for transcode in video.transcodes.all():
    transcode.file.url

Does this help?

@fabienheureux
Copy link
Author

fabienheureux commented Jan 20, 2017

Hi @timheap, thanks for your answer, in fact it does help a lot. I will try to implement it and get back with my solution here (if it can help others).

Btw, do you know the status on this issue: #9 ?

@mx-moth
Copy link
Collaborator

mx-moth commented Jan 21, 2017

#9 is a feature we would like to have, but we currently have no time to implement. No one is working on it yet.

@fabienheureux
Copy link
Author

Closing with no addition because @timheap answer was perfectly accurate.
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants