Closed arifje closed 5 years ago
no? :-(
huh, I don't know how I missed this
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!
Awesome, thanks for the quick reply!
What's the get
component about?
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!
@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
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.