Hey. Thanks a lot for this package - it's really powerful.
But I've some questions if you have a time.
As I know this library not supporting converting video and for some reason you wont extend custom conversation (issue #489).
So, I want to use this library to store video files (100-200 mb), convert them and replace the original file with converted. What is the best practises for this?
What I have:
$this->media->setCustomProperty('status', Media::MEDIA_STATUS_PROCESSING);Here I've an error when I trying to save this file or rename file. For example here a directory structure of already converted file:
/100
/100/media.mov <- original file
/100/media.mp4 <- converted file
When I tried to save it directly with my own media model it's calling package's events which retrieving error with "File media.mp4 already exists".
While I'm writing these I thought about that I can prevent fire Media model event and try to save it without media's events but is that will be a correct way?
Thanks for your time.
Lol. I think I found a solution for this as I described.
Here a result of the event listener - https://gist.github.com/Nks/b3b1cd7398a560eda8ddb7e37901869e
By the way, when you write a question and ponder it - usually the solution comes by itself :D Magic :)
Cool, thanks for posting your solution.
Wouldn't it be much easier to do all the conversions first and only add the converted video to the medialibrary? Or is there a specific reason you want the original file to be in the medialibrary as well?
@freekmurze a reason why I'm first saving item instead convert it first - I want to show a progress for a user that the file is converting (with "progress" custom attribute). Also I'm creating parent model record when uploading first file. Also in this case if decoding will fail I can send notification to myself to fix it (if issue in the ffmpeg configuration) and have an ability to load a lot of files while first file is decoding. In any case I tested it a lot of times - it works perfectly for me and it's not calling any media's events when it's updating progress, etc.
Most helpful comment
Lol. I think I found a solution for this as I described.
Here a result of the event listener - https://gist.github.com/Nks/b3b1cd7398a560eda8ddb7e37901869e
By the way, when you write a question and ponder it - usually the solution comes by itself :D Magic :)