Add a YouTube or Vimeo video as a post attachment?

I’m developing a gallery plugin and I was wondering if I could add a YouTube and Vimeo “embed” option to the media uploader to be able to add YouTube and Vimeo videos as attachments to a post instead of uploading the video files directly to the server. I’m thinking along the lines of an option with a textarea where one could put the YouTube or Vimeo HTML embed code and this would be added to the media library with a mime type of “text/html”.

Any clues would be much appreciated

2 Answers
2

Attachment represents a file on your server that you may include its url in your content. All attachments are supposed to be in the media library. It is easy to see that by this definition your idea doesn’t fit the wordpress attachment model (images that are off server are not attachments).

Your idea has merit but since it doesn’t fit the wordpress model right now (version 3.7) I am not sure how easy it will be to implement it.

Leave a Comment