I get the following error message when I try to add a youtube video under the "Web" tab of the media browser:

http://www.youtube.com/watch?v=SomeVideo could not be added. Only the following types of files are allowed to be uploaded: image, video

same thing when i try to add embed code into media browser.

I've enabled internet sources, media_youtube, and media keyword filtering in the text format type. any ideas?

Comments

arthurf’s picture

Status: Active » Postponed (maintainer needs more info)

Do you see the youtube image on the browser where you are pasting in the youtube URL?

glennnz’s picture

Same problem for me with the latest dev version, and no, there's no YT logo

glennnz’s picture

Status: Postponed (maintainer needs more info) » Active

Setting status

dave reid’s picture

Status: Active » Postponed (maintainer needs more info)

In your field's settings to you add the 'youtube://' stream to be allowed?

glennnz’s picture

@Dave

I don't see this anywhere.....

I can only allow 'Upload,' 'Library,' 'View Library' or 'Web'.

None of these give me any further settings.

donhajicek’s picture

I'm having the same issue. Still no resolution more than a month later?

primsi’s picture

I don't know if this is the same error, but in our case on node edit we can add the video, on node create we can't - getting the error mentioned above.

dave reid’s picture

StatusFileSize
new54.56 KB

This must be enabled on your file field to allow YouTube to be used:
enable-youtube-file-field.png

aaronpinero’s picture

I have this same problem when using rc2. I have properly checked the allowed URI schemes in the field settings. The only way I've been able to make this work is to first go to the media library under "content" and add the video there. Then go back to the node I'm editing and add the video from the library.

aaronpinero’s picture

Folks, you might want to try this also: http://drupal.org/project/video_filter. I have generally tried to do what I can to avoid Media Module due to the current bug:feature ratio.

dave reid’s picture

@aaronpinero: Can you please explain what exactly isn't working for you? Maybe screenshots would help us figure it out so no one else encounters this?

aaronpinero’s picture

I'm having the same problem as the person who originated this issue. I have a content type on a website that "multimedia asset" field that uses the "media file selector" widget. I've enabled "video" and "other" as the allowed media types and made sure that YouTube and Vimeo are among the allowed URI schemes (as in the screen shot posted previously on this issue). When I go to add or edit a node of this content type, I launch the media browser to be able to add a link to hosted video. I click on the "Web" tab in the browser and enter the URL of the resource into the field (basically, the URL of a YouTube video). When I submit, the media browser responds:

"[url] could not be added. Only the following types of files are allowed to be uploaded: "

With nothing after. As I said before, the only way I am able to get this to work is to go to the media library under "Content" and add a link to a video there. Then I go back to the node add/edit form and select the video I want from the "library" tab in the media browser.

My other complaints about Media module come from a complete lack of end user features. I'm sure Media module is a potential solution to an important problem in Drupal and might get incorporated into core eventually, but it is useless as a tool to help content editors add, size, and position, and annotate media within content (WYSIWYG) -- the one thing most end users are most interested in. This is something you could easily do with Image Assist in Drupal 6. Sadly, it appears an update for Image Assist was postponed because of the promise of Media. That hasn't panned out. I abandoned efforts to move sites to D7 because of this one serious lack. And until something comes along as a viable replacement, I'll stick with D6 as much as possible.

dave reid’s picture

@aaronpinero: Thanks for posting the problems you've been having. I haven't been able to replicate your YouTube error either on 1.x or 2.x. I wonder if you need to re-save your field configuration for your multimedia asset field because it sounds like something went screwy when saving its settings, based on the empty 'following types of files' in the error message.

aaronpinero’s picture

If only it had been that simple. Sadly, it is not. I've looked around again at all the various configuration screens related to Media and the media field in my content type, but I had no success.

dave reid’s picture

Priority: Major » Normal
Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Then I'm not sure what I can do any more here. I've asked for screenshots and have tried to replicate this and have been unable to do so.

swafran’s picture

I had this problem using FCKEditor, switching to CKEditor the problem disappeared.

drew reece’s picture

My 2 cents incase this gets resolved…

I'm seeing this locally, but not on a remote server. This is with the latest media-7.x-2.x-dev & media_youtube-7.x-2.x-dev.

I suspect it may be due to the PHP build & the included stream wrappers?
LOCAL Registered PHP Streams https, ftps, compress.zlib, php, file, data, http, ftp
REMOTE Registered PHP Streams https, ftps, compress.zlib, compress.bzip2, php, file, data, http, ftp, ssh2.shell, ssh2.exec, ssh2.tunnel, ssh2.scp, ssh2.sftp, zip
The remote server also has mime_magic installed.

The error does say 'Only the following types of files are allowed to be uploaded: image, audio, video' & the video does have youtube:// enabled in the settings.

I altered the error message on line 150 of media/modules/media_internet/media_internet.module to be sure it was that module & not the media_youtube module creating the message.

thelocaltourist’s picture

I'm having the same issue as #12, using the latest media-7.x-2.x-dev & media_youtube-7.x-2.x-dev

raphael apard’s picture

Using the latest media-7.x-2.x-dev & media_youtube-7.x-2.x-dev
I have no more the table "media_type" (not used anymore ?).

Uploading dailymotion give me the error "video could not be added. Only the following types of files are allowed to be uploaded:" because of function :

function media_file_validate_types(stdClass $file, $types) {
  $errors = array();
  if (!in_array(file_get_type($file), $types)) {
    $errors[] = t('Only the following types of files are allowed to be uploaded: %types-allowed', array('%types-allowed' => implode(', ', $types)));
  }
  return $errors;
}

I can pass validation if i implements hook_file_type() in media_dailymotion module like this :

function media_dailymotion_file_type($file) {
  if($file->filemime == 'video/dailymotion') {
    return array('video');
  }
}

This is a good solution ?
In this case this issue will be for media youtube module.

raphael apard’s picture

Version: 7.x-1.0-beta5 » 7.x-2.x-dev
Component: Media Browser » Media Internet
Status: Closed (cannot reproduce) » Active

re-opening with correct version.

ParisLiakos’s picture

Version: 7.x-2.x-dev » 7.x-1.0-beta5
Component: Media Internet » Media Browser
Status: Active » Closed (cannot reproduce)

See #1812976: Register video/youtube mimetype and provide an upgrade path for an explanation why this happens in latest media 2.x dev version

yanniboi’s picture

Problem is still happening in media-7.x-2.x-dev

Thanks Raphael! #19 works great! Although I would recommend putting the fix into a custom .module file rather than directly into media_dailymotion.module (or im my case youtube.... )

Barry Tielkes’s picture

Version: 7.x-1.0-beta5 » 7.x-2.0-unstable7

Same here, ) #19 works!.
Using: Media: YouTube 7.x-2.0-rc1

When i put this code in my custom module:
function MY_MODULE_file_type($file) {
	if($file->filemime == 'video/youtube') {
		return array('video');
	}
}
icampana’s picture

Status: Closed (cannot reproduce) » Needs work

I was having the same problem, tried that solution and it worked flawlessly, I guess that this should go into the media_youtube module, maybe we should move this issue to that module queue.

ParisLiakos’s picture

Status: Needs work » Closed (cannot reproduce)

it is already in..check issue @#21

jc22’s picture

StatusFileSize
new64.96 KB

I am experiencing this same issue with media 2.x and media:youtube 2.x which I downloaded on Feb 7 2013 ... =(

rnyberg’s picture

Oh yes, updated Media and Media: Youtube yesterday and this bug is back. I have correctly enabled Youtube from the File Types / Video and in the Fields settings as well, all content that had working Youtube videos now only display the "file icon" instead.

Works now as I added this to my module with adding "video/youtube" manually to the allowed mimetype list afterwards.

function MYMODULE_file_mimetype_mapping_alter(&$mapping) {
  $mapping['mimetypes']['video_youtube'] = 'video/youtube';
  $mapping['extensions']['youtube'] = 'video_youtube';
  $mapping['mimetypes']['video_twitch'] = 'video/twitch';
  $mapping['extensions']['twitch'] = 'video_twitch';
 }

Media: Twitch doesn't render correctly for anything except for "Original" style tho. Something is definately bonkers.

ParisLiakos’s picture

You need this exactly version from media_youtube: 7.x-2.x-dev and run update.php..
if after running update.php, the problem persists please open an issue in media: youtube queue.
thanks

sillo’s picture

Can anyone please help me?
i keep getting the error message when i paste youtube video, it says only types supported: video ... and yes i did check the youtube link etc. all is set the right way ..

i dunno where to paste:

When i put this code in my custom module:
function MY_MODULE_file_type($file) {
    if($file->filemime == 'video/youtube') {
        return array('video');
    }
}

can someone please help me ?

Road Kill’s picture

Hi Sillo you might want to try this out if you looking to add youtube video's without a hassel

http://drupal.org/node/1279830

sillo’s picture

Hi R.K , Thank you very much for your contribution :) i found an alternative to paste youtube videos to website .. but thank you very much.

dgtlmoon’s picture

worked for me, just had to ensure the correct file type was enabled in the content type field settings too

robbe-1’s picture

Status: Closed (cannot reproduce) » Closed (fixed)

Normally I'm not the commenting type, but this is an easy fix without custom modules.

  1. Go to: YOURSITE/admin/structure/file-types/manage/video
  2. Paste 'video/youtube' in the field 'Mimetypes' (on a new line)
  3. DONE!

(I first tried the custom module mentioned in #23 and it also worked, but it was one more of those minifix modules I did not really need)

dgtlmoon’s picture

could it be documentation issue? hmm unsure

dave reid’s picture

A reminder, this is *already* fixed if you use Media: Youtube 7.x-2.x. All you need to do is update to the latest dev.

jwilson3’s picture

Version: 7.x-2.0-unstable7 » 7.x-2.x-dev
StatusFileSize
new49.76 KB
new41.13 KB
new97.13 KB
new101.91 KB

Actually, Dave, I've updated to 7.x-2.x-dev with drush, which grabbed me a version of the code called 7.x-2.0-rc2+3-dev dated 2013-03-23, I've also used 7.x-2.0-rc3 which is dated 2013-05-01, and has exactly the same contents.

I'm still getting this error trying to embed a video into a wysiwyg CKeditor via the "add media" button + media browser popup, with the same error message being produced as the OP.

I do see both youtube and vimeo enabled in the "Web" tab of the Media Browser, and it appears that that there is no longer an option to specify the protocols by name (eg "youtube://") anymore.

The only way to fix this was to complete the steps in #33 by hand. I'm not sure why this wasn't done automatically by the module when I installed it. I won't re-open unless someone else can confirm this too, but I'm not 100% sure this can be considered fixed.

A couple snapshots are attached.

jwilson3’s picture

Project: D7 Media » Media: YouTube
Component: Media Browser » Code

I think this makes more sense in the Media_YouTube queue.

dave reid’s picture

Project: Media: YouTube » D7 Media
Component: Code » Media Browser

Did you also update to the latest File entity and Media 7.x-2.x-dev? There were some fixes in File entity to default the video file type to use a wildcard (video/*) by default.

jwilson3’s picture

I had the latest media dev, but not file_entity... (still had an older dev snapshot) and can confirm that updating it fixed the problem.

After grabbing latest file_entity and running the update the mimetype list on admin/structure/file-types/manage/video/edit looks like:

video/*
video/vimeo
video/vimeo

It's strange that video/vimeo was (and still is) present in the mimetype list even before the file_entity update, but not video/youtube. Oh well, I guess the wild card works too.

And, forgot to say, thanks for the tip to update file_entity!

dave reid’s picture

Ok yeah sorry I did not included the *other* critical information about updating to File entity dev as well.

The double entries for vimeo should be fixed for new users upgrading with #1950188: Remove media_vimeo_update_7200() and media_vimeo_file_default_types_alter().

dave reid’s picture

Issue summary: View changes

Make error message more visible

pdcarto’s picture

Issue summary: View changes

I'm running media and file_entity alpha2, and am still getting this error. Running admin/structure/file-types/upgrade seemed to have no effect (the {file_types_mimetypes} table remains empty). The mime types are encoded fine in {file_type}.mimetypes (a serialized array), and CRUD correctly at /admin/structure/file-types/manage/%filetype/edit. However the types that are populated in the #validate arguments for the media browser form are not being populated from these. It seems to just be putting in the file type ('video' in this case) rather than the available mimetypes.

Furthermore, the MY_MODULE_file_type fix isn't working for me because it runs *after* media_file_validate_types is called (and returns error).

I managed to hack something that works with hook_media_browser_params_alter:

/**
 * Implements hook_media_browser_params_alter
 * to add the mimetypes into the permissible file types for videos
 * without this, all video/* mimetypes fail to validate
 * 
 * @param $stored_params
 */
function MYMODULE_media_browser_params_alter(&$stored_params) {
  if ($stored_params['types'] == 'video') {
    $stored_params['types'] = array($stored_params['types']);
    foreach($stored_params['schemes'] as $scheme) {
      if($scheme) {
        // This probably isn't valid, but seems to work
        $stored_params['types'][] = 'video/' . $scheme;
      }
    }
  }
}

I suspect that this isn't a problem on new-installs, and that the problem stems from the upgrade path that my particular site took. But the existence of the file_types_mimetypes table is very puzzling, since file_entity seems to ignore it after creating it.

mastoll’s picture

I am using the latest dev releases of Media, 7.x-2.0-alpha3+79-dev,
File Entity, 7.x-2.0-alpha3+18-dev, and
MediaElement 7.x-1.2+2-dev, not Media:YouTube
and am receiving the same error as OP with all file types listed.

I've read so much about this issue I'm now confused about where to start? Is it a Media issue or not?

smasm’s picture

Ooh I FOUND VERY EASY WAY TO FIX THIS PROBLEM..

if you want to add a youtube link to it. You basically have to change http to youtube

for example:
http://www.youtube.com/someFile

to

youtube://www.youtube.com/someFile

It worked with me. Hopefully that helps some of you.

alexberendei’s picture

#43 worked! Thank you smasm !

nithinkolekar’s picture

I can confirm issue still exist and could be reproduced with recommended Media v 7.x-2.19, Media: YouTube v 7.x-3.5, specifically with chrome browser but works fine with Firefox.(see update below)

Update : after further digging by updating media_youtube to 7.x-3.7 I found that actual problem is with non-admin user role which causing this. Earliar I was testing with non-admin user in chrome and with admin user in firefox which makes me think its was browser specific but it wasn't. Sorry about that :(

Now actual issue: Even with permission "Add media from remote services","Use the media browser" and "View files" (Includes the following stream wrappers: SoundCloud audio, Vimeo videos, YouTube videos, Public files.) set to non-admin role for ex. siteadmin this error is raised irrespective of browsers.
Is there any other permission I need to set for that role?

muneender’s picture

I faced the same issue. I was able to create a Youtube video from admin login but I was unable to create Youtube Video from non-admin roles login.

Solution:

Edit the File Field setting "Allowed file types" and Unselect all options. Unselecting all options will allow all file types including Youtube.

felubra’s picture

In my case I've fixed the issue after granting the permission 'Add and upload new files' of the File Entity module.

jtjones23’s picture

#47 worked for me...thank you felubra