nystudio107 / craft-transcoder

Transcode video & audio files to various formats, and provide video thumbnails
https://nystudio107.com/plugins/transcoder
Other
43 stars 12 forks source link

[FR] GraphQL Support #33

Open denisyilmaz opened 4 years ago

denisyilmaz commented 4 years ago

I can't find anything in the documentation: Can this plugin be used to include transcoded video url fields via GraphQL directly for an asset?

denisyilmaz commented 4 years ago

For example something like url @transcode(…) would be great.

{
  asset(kind: "video") {
    title
    url @transcoder(width:768 ,videoBitRate:"500k")
  }
}
denisyilmaz commented 4 years ago

@khalwat I guess this has no priority?

khalwat commented 4 years ago

It isn't something I'd planned to implement, but if enough people are interested, sure.

Understand if the video is in the middle of transcoding, you'll get nothing back. But I suppose that's not much different than the current Twig API.

denisyilmaz commented 4 years ago

alright, thanks for that information. then I hope there are people out there requesting this feature as well.

For anyone searching for a temporary solution, I used the Preparse Field Plugin that I added to the asset entry type to trigger the video transcoding. Here is the twig code I used to create a mp4 version of a video:

{% set myAsset = craft.assets().uid(element.uid).one() %}
{% if myAsset.kind == 'video' %}
    {% set mp4 = craft.transcoder.getVideoUrl(myAsset, {
        "width": "",
        "height": "",
    }) %}
    {{ { 'mp4': mp4 } | json_encode }}
{% endif %}

@khalwat are there events I could listen to inside a custom module to trigger a resave of that field when the transcoding is finished? Could not find anything in the documentation

gaelpleeroy commented 2 years ago

Hello @khalwat any news on that? We got some self-hosted video assets and it seems this is the only plugin available. Also is there a roadmap?

khalwat commented 2 years ago

@gaelpleeroy I have not done any work on implementing a GraphQL API for the Transcoder plugin. You're the second person who has requested such a feature, though, which adds to its likelihood of being implemented

denisyilmaz commented 2 years ago

hi @khalwat , any plans to get this feature implemented in the near future?

khalwat commented 2 years ago

It's on the list, but not immediately unfortunately.

benfeather commented 10 months ago

I'd really like to see GraphQL support as well.