Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm successfully uploading videos to youtube through my Media field. But I need two features.
1. Deleting local copy of video
2. After uploading to YouTube embed link in Web tab of Media browser.
What ways you can suggest me? Solutions?
Comments
Comment #1
Toktik CreditAttribution: Toktik commentedComment #2
Toktik CreditAttribution: Toktik commentedBasically my goal is to delete original video from my server and display everywhere(node, views) uploaded youtube video.
Comment #3
camdarley CreditAttribution: camdarley commented1. Media Derivatives API provide a "delete source" checkbox in the preset settings (admin/config/media/media-derivatives/list/youtube_video/edit).
2. If you set the File Type to "managed" in the preset options, a youtube file will be created, like if you add it through the Web tab (it use the streamwrapper from media_youtube). Then you can use it as any other media...
Hope that it solve your problem. Let me know if you have other questions
Comment #4
Toktik CreditAttribution: Toktik commentedThank you so much for support and great module!
I have changed to managed and ticked delete Source. Youtube file appeared library, but now I want to silently select Youtube link instead of file, how can I achieve this?
Source delete not worked. There is no error in logs. Any ideas?
Comment #5
camdarley CreditAttribution: camdarley commentedThis features belong to Derivatives API module.
The solution would be to add a new option "delete source file and replace it by derivative".
I'm quite busy now but I'll think about it as soon as possible.
Comment #6
camdarley CreditAttribution: camdarley commentedAbout source deletion problem, it's actually a code error, see #1402420: Delete source file not working.
Comment #7
slashrsm CreditAttribution: slashrsm commentedI was thinking about solution for this... There is everything clear if we have derivative file that is managed. Then we just update source file with derivative's data and save it.
But what about the case, when we have derivative, that is unmanaged? Do we delete source and keep derivatives as unmanaged file? Do we convert derivative to a managed file and update source file's object?
I think the latter solution is probably the best. Should we do it this way or let user decide?
Comment #8
camdarley CreditAttribution: camdarley commentedI agree, the second solution is better, and i think that it's not necessary to let user decide: I find no context that needs to keep unmanaged derivative of a deleted source file, but i can be wrong. Also, it could be confusing for end user.
Comment #9
slashrsm CreditAttribution: slashrsm commentedWhat about if we limit this replace function to managed derivatives only? That will make user aware, that the output of a derivation like this will always be a managed file.
Am I right?
Comment #10
lex0r CreditAttribution: lex0r commentedSubscribe.
Basically we need to replace the uploaded file with the derivative, and update its path. We don't care about whether the derivative is managed or unmanaged - we need a managed file (referenced by file field) updated with the derivative one.
I propose adding one more option to the basic setup - Replace source (that will be a radio, as well as Delete source that is now a checkbox).
Comment #11
lex0r CreditAttribution: lex0r commentedAnother moment that is very important.
When uploading and converting a file the derivative must be saved to the target directory defined for that field instance.
This is an absolute *must have* since we want all the files to be stored in one place set when creating a field. The default "public" is too simple...
Comment #12
jwjoshuawalker CreditAttribution: jwjoshuawalker commented@lex0r I agree 100%.
Found this module right before I was about to build the same thing for ffmpeg :)
In the case of ffmpeg ( Simple ffmpeg Engine ) I guess derivatives api will hand the correct path over to ffmpeg command line? Or is there something more fancy going on here?
I could knock it out real quick if the former is the case.
Comment #13
slashrsm CreditAttribution: slashrsm commented@drastik: Yes, engine will take care about paths.