DeuxHuitHuit / craft-cloudflare-stream

Upload your videos assets to Cloudflare Stream from Craft CMS assets interface
https://plugins.craftcms.com/cloudflare-stream
Other
1 stars 1 forks source link

Video not uploaded to Cloudflare after importing entry (with assets) with FeedMe #12

Open arifje opened 2 months ago

arifje commented 2 months ago

In addition to my previous issue we also noticed entries that are imported from another site with FeedMe, that contain assets (also in a Matrix) are also not uploaded to Cloudflare.

arifje commented 2 months ago

Any idea when this is going to be checked?

nitriques commented 1 month ago

@arifje Oh! We never tried to import videos.

Do you have auto upload turned on ? If not, that might be the reason why. If you do have it, you should also see something in your queue....

arifje commented 3 weeks ago

Yes it's all turned on, but my guess is that you're using the wrong event when assets are uploaded. There are different ways to approach this. I've built a plugin based on this one, but for uploading assets to Bunny Stream CDN, which works like it should work, and I am using this one:

Event::on(
    Asset::class,
    Asset::EVENT_AFTER_SAVE, 
    function (Event $event) {
        }
);

This triggers when uploading an new assets (drag and drop, but also when importing with FeedMe).

nitriques commented 3 weeks ago

Hey @arifje

We ... do ? https://github.com/DeuxHuitHuit/craft-cloudflare-stream/blob/18aabf6c9098ffe6d5f4b37c7bf375738bf98278/src/Plugin.php#L233 ?

After save is declared in the Element class : https://github.com/craftcms/cms/blob/40e7b4b5bcaaaf841cc69339451e8eb154c2f663/src/base/Element.php#L692

Asset::EVENT_AFTER_SAVE work because Assets extends Element https://github.com/craftcms/cms/blob/40e7b4b5bcaaaf841cc69339451e8eb154c2z663/src/gql/types/elements/Asset.php#L21

I order words: it's the same string.


If the upload job is not created, it may be due to one of the following conditions: https://github.com/DeuxHuitHuit/craft-cloudflare-stream/blob/18aabf6c9098ffe6d5f4b37c7bf375738bf98278/src/Plugin.php#L100