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

Added GIF to video encoding, multiple target paths #7

Closed arifje closed 5 years ago

arifje commented 6 years ago
arifje commented 6 years ago

no? :-(

khalwat commented 5 years ago

huh, I don't know how I missed this

khalwat commented 5 years ago

I see a few things in the validators that I'll need to fix up, but otherwise looks good! I'll do some QA on it shortly, thanks!

arifje commented 5 years ago

Awesome, thanks for the quick reply!

khalwat commented 5 years ago

What's the get component about?

arifje commented 5 years ago

Hi,

I needed access to the functions in services/Transcode.php for use of your plugin on a PHP/API level.

Currently I am using the Elements API to create JSON feeds from my data, which also includes references to video files/assets. So I needed to run getVideoUrl() and getVideoThumbnailUrl() to get the right URL's (encoded versions), but didn't find a way to access them.

After looking into other addons the only difference was this setComponent definition, which results in accessing all of these functions.

Docs: https://docs.craftcms.com/v3/extend/services.html

Code example from my Element API endpoint;

use nystudio107\transcoder\Transcoder;

// transcoder     
$encodedVideoUrl = Transcoder::$plugin->get->getVideoUrl($video, []);
$encodedThumbnail = Transcoder::$plugin->get->getVideoThumbnailUrl($video, [
    'width' => 800,
    'height' => 450,
    'timeInSecs' => 5
]);

This works perfectly now!

khalwat commented 5 years ago

@skoften you should have been able to access them via:

Transcoder::$plugin->transcode->getVideoUrl();
Transcoder::$plugin->transcode-> getVideoThumbnailUrl();

...etc. Just like it's done here: https://github.com/nystudio107/craft-transcoder/blob/v1/src/variables/TranscoderVariable.php#L39

khalwat commented 5 years ago

I'm going through and refactoring some of this PR; it's somewhat problematic, because it changes the public URLs where things live

For instance, devMode.fm uses Transcoder to create all of its shows, which exist in RSS feeds that are cached in clients all over the world... and by default, this PR will change the urls from /transcoder/ to /transcoder/audio/

Working on figuring out a way to refactor it without this impact.