Video not displayed due to blip.tv provider use of original url instead of Flash

Markus Sandy - July 21, 2007 - 18:51
Project:Embedded Media Field
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

Thanks for a great module. This is my first Drupal issue, so please let me know if I leave something important out.

I installed the emfield module without problems and added a video field to a blog post. I entered in a blip.tv url of http://blip.tv/file/180478. The player and preview image showed up, but no video played. Using view source, I could see that the output was using the original Quicktime url instead of the transcoded Flash one (e.g., http://blip.tv/file/get/Apperceptions-ATasteOfDrupalConAndOSCMSSummit200... instead of http://blip.tv/file/get/Apperceptions-ATasteOfDrupalConAndOSCMSSummit200...)

Reading over the blip.tv provider include file, I noticed that it uses the url attribute of the single enclosure tag from a blip.tv rss file (http://apperceptions.blip.tv/file/180478?skin=rss in this case). This is not necessarily the Flash encoded version of the video for the given blip.tv post url that is entered by the end user. The url and type of the enclosure element depends on the original upload format or on the default video type setting at blip.tv.

This suggests a workaround for some users: set your default video type to "flash" on your blip.tv account. This won't work for me as I have many cross-posted videos that would be adversely effected by such a global change.

For the provider include file, I thought it might be better to look for <media:content> elements with a type attribute of "video/x-flv" to determine *if* there is a compatible format for use in the player. Alternatively, one could simply replace any file extension with ".flv".

Here is the snippetfrom video_cck_bliptv_data that is at the heart of the issue:

  // this gets sent to the player
  $data['flv'] = $rss['ITEM']['ENCLOSURE'][1]['URL'];

I tried to replace it with the following search through <media:content> elements. However, it seems to return null for the first entry, which is the very one we want!!!

  $mediacontent = $rss['ITEM']['MEDIA:GROUP']['MEDIA:CONTENT'];
  foreach ($mediacontent as $file) {
    if ($file['TYPE'] == "video/x-flv") {
        $data['flv'] = $file['URL'];
        break;
    }
  }

Can anyone tell me why the above code has a null in the first entry? Until I can figure out why, I punted and used brute force instead:

  if (!$data['flv']) {
    $parts = explode(".", $rss['ITEM']['ENCLOSURE'][1]['URL'];);
    $parts[count($parts)-1] = "flv";
    $data['flv'] = implode(".", $parts);;
  }

and now the video plays :) It's about DrupalCon and you can see it at http://ladrupal.org/blog/admin/video_test. This is a Drupal 5.1 under PHP 4 on Apache site with emfield bliptv.inc version is 1.1 2007/06/26. Thanks!

#1

Markus Sandy - July 21, 2007 - 19:04

There are some extra semi-colons in that last snippet. Also, the if statement is only needed if the snippet follows the one before it that searches the <media:content> elements. It should just be:

    $parts = explode(".", $rss['ITEM']['ENCLOSURE'][1]['URL']);
    $parts[count($parts)-1] = "flv";
    $data['flv'] = implode(".", $parts);

 
 

Drupal is a registered trademark of Dries Buytaert.