diff options
author | Heshan Wanigasooriya <heshanmw@gmail.com> | 2010-03-23 04:17:29 +0000 |
---|---|---|
committer | Heshan Wanigasooriya <heshanmw@gmail.com> | 2010-03-23 04:17:29 +0000 |
commit | 8041073c8d74e5d24e3b9f10143f3e4bd04db2de (patch) | |
tree | 89827aac40d499a41c4deae85719712630836568 /includes | |
parent | b66f50d2ce11d0cc8bb53af94ad86278d3fe8e51 (diff) | |
download | video-8041073c8d74e5d24e3b9f10143f3e4bd04db2de.tar.gz video-8041073c8d74e5d24e3b9f10143f3e4bd04db2de.tar.bz2 |
removing old files and commenting new file field and other files to the vidoe module page.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/apiclient.inc | 135 | ||||
-rw-r--r-- | includes/common.inc | 384 | ||||
-rw-r--r-- | includes/video.views.inc | 135 | ||||
-rw-r--r-- | includes/video.views_default.inc | 233 | ||||
-rw-r--r-- | includes/video_views_handler_field_download.inc | 37 | ||||
-rw-r--r-- | includes/video_views_handler_field_image.inc | 74 | ||||
-rw-r--r-- | includes/video_views_handler_field_play.inc | 31 | ||||
-rw-r--r-- | includes/video_views_handler_field_playtime_seconds.inc | 76 |
8 files changed, 201 insertions, 904 deletions
diff --git a/includes/apiclient.inc b/includes/apiclient.inc deleted file mode 100644 index 88468cb..0000000 --- a/includes/apiclient.inc +++ /dev/null @@ -1,135 +0,0 @@ -<?php -//$Id$ -/** - * @file - * Some functions for using video hosting providers api (Youtube, Google Video, etc..) - * Part of this code has been inspired by the video_cck module and adapted - * for the video module by jyamada1 - * - * @author Fabio Varesano <fvaresano at yahoo dot it> - * porting to Drupal 6 - * @author Heshan Wanigasooriya <heshan at heidisoft.com><heshanmw@gmail.com> - * @todo - */ - - -/** -* When an include file requires to read an xml to receive information, such as for thumbnails, -* this script can be used to request the xml and return it as an array. -* Note that this is a modified function from the flickr.module, made to handle this type of -* call more generically. also, i suspect it could be done easier (and more quickly) in php 5. -* @param $provider -* the string of the third party provider, such as 'youtube' or 'google' -* @param $url -* the url for the xml request -* @param $args -* an array of args to pass to the xml url -* @param $cacheable -* optional; if true, the result of this xml request will be cached. good to play nice w/ -* the third party folks so they don't stop providing service to your site... -* @return -* the xml results returned as an array -*/ -function _video_apiclient_request_xml($provider, $url, $args = array(), $cacheable = true) { - ksort($args); - - // build an argument hash that we'll use for the cache id and api signing - $arghash = $provider . ':'; - foreach($args as $k => $v){ - $arghash .= $k . $v; - } - - // build the url - foreach ($args as $k => $v){ - $encoded_params[] = urlencode($k).'='.urlencode($v); - } - $url .= '?'. implode('&', $encoded_params); - - // if it's a cachable request, try to load a cached value - if ($cacheable) { - if ($cache = cache_get($arghash, 'cache')) { - return unserialize($cache->data); - } - } - - // connect and fetch a value - $result = drupal_http_request($url); - - if ($result->code == 200) { - $parser = drupal_xml_parser_create($result->data); - $vals = array(); - $index = array(); - xml_parse_into_struct($parser, $result->data, $vals, $index); - xml_parser_free($parser); - - $params = array(); - $level = array(); - $start_level = 1; - foreach ($vals as $xml_elem) { - if ($xml_elem['type'] == 'open') { - if (array_key_exists('attributes',$xml_elem)) { - list($level[$xml_elem['level']],$extra) = array_values($xml_elem['attributes']); - } else { - $level[$xml_elem['level']] = $xml_elem['tag']; - } - } - if ($xml_elem['type'] == 'complete') { - $php_stmt = '$params'; - while($start_level < $xml_elem['level']) { - $php_stmt .= '[$level['.$start_level.']]'; - $start_level ++; - } - $php_stmt .= '[$xml_elem[\'tag\']][] = $xml_elem[\'value\'];'; - eval($php_stmt); - $start_level--; - } - } - - // save a cacheable result for future use - if ($cacheable) { - cache_set($arghash, 'cache', time() + 3600, serialize($params)); - } - return $params; - } - return array(); -} - - -/** -* Create a file object from thumbnail images from providers -* to allow for automatic thumbnailing of videos from providers -* @param $node -* the video node being called -* @return -* a file object containing the thumbnail file -*/ -/* -function _video_apiclient_provider_auto_thumbnail($node) { - // get thumbnail url - if(_video_get_filetype($node->vidfile) == 'youtube') { - $thumbnail = _video_apiclient_youtube_thumbnail($node->vidfile); - } - else { - $thumbnail = _video_apiclient_google_thumbnail($node->vidfile); - } - - // save image to temp directory for processing - $image = image_gd_open($thumbnail, 'jpeg'); - $location = file_directory_temp() .'/'. $node->vidfile .'.jpg'; - image_gd_close($image, $location, 'jpeg'); - - - // get info and build a file object - $filepath = file_create_path($location, file_directory_temp()); - $info = image_get_info($filepath); - - $file = new stdClass(); - $file->filepath = realpath($filepath); - $file->filename = basename($file->filepath); - $file->filesize = $info['file_size']; - $file->filemime = $info['mime_type']; - - return $file; -} -*/ - diff --git a/includes/common.inc b/includes/common.inc index c70a7a5..ce9d89c 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -4,57 +4,82 @@ * @file * Add some common functions for the various video types supported * - * @author Fabio Varesano <fvaresano at yahoo dot it> - * porting to Drupal 6 - * @author Heshan Wanigasooriya <heshan at heidisoft.com><heshanmw@gmail.com> - * @author Glen Marianko Twitter@demoforum <glenm at demoforum dot com> * @todo Configure default players by video filetype (user configurable?) */ + /** * Get the object for the suitable player for the parameter resource -*/ -function _video_common_get_player($node) { - switch (_video_get_filetype($node->vidfile)) { + */ +function _video_common_get_player($element) { + $field = content_fields($element['#field_name'], $element['#type_name']); + $resolution = array_filter(explode(':', $field['widget']['default_resolution'])); + $element['#item']['data']['height'] = $element['#item']['data']['width'] * ($resolution[1]/$resolution[0]); + + $op = _video_get_filetype($element['#item']['filename']); + //play HQ mp4 videos in flash player + if(variable_get('mp4_play_in_flowplayer', FALSE) && $op == 'mp4'){ + $op = 'mp4f'; + } + switch ($op) { case 'divx': - return theme('video_play_divx', $node); + return theme('video_play_divx', $element); case 'mov': case '3gp': case '3g2': - case 'mp4': - return theme('video_play_quicktime', $node); + case 'mp4': // video/mp4 + return theme('video_play_quicktime', $element); case 'rm': - return theme('video_play_realmedia', $node); - case 'flv': - return theme('video_play_flash', $node); + return theme('video_play_realmedia', $element); + case 'mp4f': + case 'f4v' : + case 'flv' : // flowplayer also supprts MP4, H.264 (.extension?) + return theme('video_play_flash', $element); case 'swf': - return theme('video_play_swf', $node); + return theme('video_play_swf', $element); case 'dir': case 'dcr': - return theme('video_play_dcr', $node); + return theme('video_play_dcr', $element); case 'asf': case 'wmv': case 'avi': case 'mpg': case 'mpeg': - return theme('video_play_windowsmedia', $node); + return theme('video_play_windowsmedia', $element); case 'ogg': - return theme('video_play_ogg_theora', $node); - case 'youtube': - return theme('video_play_youtube', $node); - case 'googlevideo': - return theme('video_play_googlevideo', $node); + return theme('video_play_ogg_theora', $element); default: - drupal_set_message('Video type not supported', 'error'); + drupal_set_message('No video player is configured for ' .$op, 'error'); break; } } + +/** + * Pull the file extension from a filename + * + * @param $vidfile + * string filename to get the filetype from. + * + * @return + * string value of file type or boolean FALSE on error + */ +function _video_get_filetype($vidfile) { + if (strstr($vidfile, '.')) { //If file contains a "." then get the file extension after the ". + $file_type = end(explode('.', $vidfile)); + } + else { + $file_type = FALSE; + } + + return strtolower($file_type); +} + /********************************************************************* * Themeable functions for playing videos. They print a page with a player embedded. *********************************************************************/ - /** +/** * Play videos from in FLV Flash video format * * @param $node @@ -63,44 +88,34 @@ function _video_common_get_player($node) { * @return * string of content to display */ -function theme_video_play_flash($node) { - $loader_location = variable_get('video_flvplayerloader', 'FlowPlayer.swf'); - - $url = _video_get_fileurl($node->vidfile); - $file = basename($url); - $base_url = substr($url, 0, strrpos($url, '/')); - - $height = $node->video_scaled_y + 24; // add commands height - - // this will be executed by not Internet Explorer browsers - $output = '<!--[if !IE]> <--> -<object type="application/x-shockwave-flash" width="'. $node->video_scaled_x .'" height="'. $height .'" -data="'. url() . check_plain($loader_location) .'"> -<!--> <![endif]-->' . "\n"; - - // this will be executed by Internet Explorer - $output .= '<!--[if IE]> -<object type="application/x-shockwave-flash" width="'. $node->video_scaled_x .'" height="'. $height .'" -classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" -codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"> -<![endif]-->' . "\n"; - - // params will be passed to both IE or not IE browsers - $config = sprintf("config={'playerId':'player','clip':{'url':'%s'},'playlist':[{'url':'%s','autoPlay':%s}]}", $base_url . '/' . $file, $base_url . '/' . $file, (variable_get('video_autoplay', TRUE) ? 'true' : 'false')); - $output .= '<param name="movie" value="' . url() . check_plain($loader_location) . '" /> - <param name="allowFullScreen" value="true" /> - <param name="wmode" value="transparent" /> - <param name="allowScriptAccess" value="sameDomain" /> - <param name="quality" value="high" /> - <param name="flashvars" value="' . $config . '" />' - . _video_get_parameters($node) . - '<p>'. t('Your browser is not able to display this multimedia content.') .'</p> -</object>'; - - $output = theme('video_format_play', $output, t('http://get.adobe.com/flashplayer/'), - t('Link to Adobe Flash Player Download Page'), - t('Download latest Flash Player')); - return $output; +function theme_video_play_flash($element) { +//TODO : remove item height set in here + $video = file_create_url($element['#item']['filepath']); + // echo file_create_url($element['#item']['filepath']); + $width = isset($element['#item']['data']['width']) ? $element['#item']['data']['width'] : ''; + $height = isset($element['#item']['data']['height']) ? $element['#item']['data']['height'] : ''; + $width = empty($width) ? '350px' : $width .'px'; + $height = empty($height) ? '285px' : $height .'px'; + $id = $element['#formatter']; + + if (module_exists('flowplayer')) { + $output = theme('flowplayer', array( + 'clip' => array( + 'url' => $video, + //TODO: Make settings for this + 'autoPlay' => variable_get('video_autoplay', TRUE), // Turn autoplay off + 'autoBuffering' => variable_get('video_autobuffering', TRUE), + ), + ), + $id, array( + 'style' => "width: $width; height: $height", + ) + ); + } + else { + $output='<p>Use <b>SwfTools Module</b> to play FLV files if you only convert/upload FLV videos or <b>FlowPlayer Module</b> must be enabled in order to play FLV videos with other types.</p>'; + } + return $output; } /** @@ -112,31 +127,36 @@ codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#ve * @return * string of content to display */ -function theme_video_play_swf($node) { +function theme_video_play_swf($element) { + + $video = file_create_url($element['#item']['filepath']); + $width = isset($element['#item']['data']['width']) ? $element['#item']['data']['width'] : ''; + $height = isset($element['#item']['data']['height']) ? $element['#item']['data']['height'] : ''; + $width = empty($width) ? '350px' : $width .'px'; + $height = empty($height) ? '285px' : $height .'px'; - $url = _video_get_fileurl($node->vidfile); // this will be executed by not Internet Explorer browsers $output = '<!--[if !IE]> <--> -<object type="application/x-shockwave-flash" width="'. $node->video_scaled_x .'" height="'. $node->video_scaled_y .'" -data="'. $url .'"> -<!--> <![endif]-->' . "\n"; + <object type="application/x-shockwave-flash" width="'. $width .'" height="'. $height .'" + data="'. $video .'"> + <!--> <![endif]-->' . "\n"; // this will be executed by Internet Explorer $output .= '<!--[if IE]> -<object type="application/x-shockwave-flash" width="'. $node->video_scaled_x .'" height="'. $node->video_scaled_y .'" -classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" -codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"> -<![endif]-->' . "\n"; + <object type="application/x-shockwave-flash" width="'. $width .'" height="'. $height .'" + classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" + codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"> + <![endif]-->' . "\n"; // params will be passed to both IE or not IE browsers - $output .= '<param name="movie" value="'. $url .'" />'. "\n" . + $output .= '<param name="movie" value="'. $video .'" />'. "\n" . '<param name="wmode" value="transparent" />' . "\n" - . _video_get_parameters($node) . - '<p>'. t('Your browser is not able to display this multimedia content.') .'</p> -</object>'; - - $output = theme('video_format_play', $output, t('http://www.macromedia.com/go/getflashplayer'), t('Link to Flash player download'), t('Download the latest Flash player')); + . //_video_get_parameters($node) . + '<p>'. t('Your browser is not able to display this multimedia content.') .'</p> + </object>'; +/* + $output = theme('video_format_play', $output, t('http://www.macromedia.com/go/getflashplayer'), t('Link to Flash player download'), t('Download the latest Flash player'));*/ return $output; } @@ -152,33 +172,37 @@ codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#ve * string of content to display */ -function theme_video_play_dcr($node) { +function theme_video_play_dcr($element) { - $url = _video_get_fileurl($node->vidfile); + $video = file_create_url($element['#item']['filepath']); + $width = isset($element['#item']['data']['width']) ? $element['#item']['data']['width'] : ''; + $height = isset($element['#item']['data']['height']) ? $element['#item']['data']['height'] : ''; + $width = empty($width) ? '350px' : $width .'px'; + $height = empty($height) ? '285px' : $height .'px'; // this will be executed by not Internet Explorer browsers $output = '<!--[if !IE]> <--> -<object type="application/x-director" width="'. $node->video_scaled_x .'" height="'. $node->video_scaled_y .'" -data="'. $url .'"> -<!--> <![endif]-->' . "\n"; + <object type="application/x-director" width="'. $width .'" height="'. $height .'" + data="'. $video .'"> + <!--> <![endif]-->' . "\n"; // this will be executed by Internet Explorer - $output .= '<!--[if IE]> -<object type="application/x-director" width="'. $node->video_scaled_x .'" height="'. $node->video_scaled_y .'" -classid="clsid:166B1BCA-3F9C-11CF-8075-444553540000" -codebase="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=10,0,0,0"> -<![endif]-->' . "\n"; - -// params will be passed to both IE or not IE browsers - $output .= '<param name="src" value="'. $url .'" />' . "\n" - . _video_get_parameters($node) . - '<p>'. t('Your browser is not able to display this multimedia content.') .'</p> -</object>'; + $output .= '<!--[if IE]> + <object type="application/x-director" width="'. $width .'" height="'. $height .'" + classid="clsid:166B1BCA-3F9C-11CF-8075-444553540000" + codebase="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=10,0,0,0"> + <![endif]-->' . "\n"; + // params will be passed to both IE or not IE browsers + $output .= '<param name="src" value="'. $video .'" />' . "\n" + . //_video_get_parameters($node) . + '<p>'. t('Your browser is not able to display this multimedia content.') .'</p> + </object>'; +/* $output = theme('video_format_play', $output, t('http://www.macromedia.com/shockwave/download/'), t('Link to Macromedia Shockwave Player Download Page'), - t('Download latest Shockwave Player')); - return $output; + t('Download latest Shockwave Player'));*/ + return $output; } /** @@ -191,26 +215,31 @@ codebase="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#vers * @return * string of content to display */ -function theme_video_play_divx($node) { - //Increase the height to accommodate the player controls on the bottom. - $height = $node->video_scaled_y + 20; +function theme_video_play_divx($element) { +//Increase the height to accommodate the player controls on the bottom. + $video = file_create_url($element['#item']['filepath']); + $width = isset($element['#item']['data']['width']) ? $element['#item']['data']['width'] : ''; + $height = isset($element['#item']['data']['height']) ? $element['#item']['data']['height'] : ''; + $width = empty($width) ? '350px' : $width .'px'; + $height = empty($height) ? '285px' : $height .'px'; - $url = _video_get_fileurl($node->vidfile); + //$url = _video_get_fileurl($node->vidfile); $output = '<!-- [if IE] --> -<object classid="clsid:67DABFBF-D0AB-41fa-9C46-CC0F21721616" width="'.$node->video_scaled_x.'" height="'.$height.'" codebase="http://go.divx.com/plugin/DivXBrowserPlugin.cab"> -<!--> <![endif]-->'. "\n"; + <object classid="clsid:67DABFBF-D0AB-41fa-9C46-CC0F21721616" width="'.$width.'" height="'.$height.'" codebase="http://go.divx.com/plugin/DivXBrowserPlugin.cab"> + <!--> <![endif]-->'. "\n"; // this will be executed by not Internet Explorer browsers $output = '<!-- [if !IE] --> -<object type="video/divx" data="'.$url.'" width="'.$node->video_scaled_x.'" height="'.$height.'" mode="zero"> -<!--> <![endif]-->'."\n"; + <object type="video/divx" data="'.$video.'" width="'.$width.'" height="'.$height.'" mode="zero"> + <!--> <![endif]-->'."\n"; - $output .= '<param name="src" value="'.$url.'"/>'."\n"; + $output .= '<param name="src" value="'.$video.'"/>'."\n"; $output .= '<param name="mode" value="zero"/>'."\n"; $output .= '</object>'; + /* $output = theme('video_format_play', $output,t('http://www.divx.com/divx/webplayer/'), t('Link to DivX Download Page'), - t('Download latest DivX Web Player')); + t('Download latest DivX Web Player'));*/ return $output; } @@ -224,45 +253,38 @@ function theme_video_play_divx($node) { * @return * string of content to display */ -function theme_video_play_quicktime($node) { - //Increase the height to accommodate the player controls on the bottom. - $height = $node->video_scaled_y + 16; - - $url = _video_get_fileurl($node->vidfile); +function theme_video_play_quicktime($element) { +//Increase the height to accommodate the player controls on the bottom. + $video = file_create_url($element['#item']['filepath']); + $width = isset($element['#item']['data']['width']) ? $element['#item']['data']['width'] : ''; + $height = isset($element['#item']['data']['height']) ? $element['#item']['data']['height'] : ''; + $width = empty($width) ? '350px' : $width .'px'; + $height = empty($height) ? '285px' : $height .'px'; // this will be executed by not Internet Explorer browsers $output = '<!--[if !IE]> <--> -<object type="video/quicktime" width="'. $node->video_scaled_x .'" height="'. $height .'" -data="'. $url .'"> -<!--> <![endif]-->' . "\n"; + <object type="video/quicktime" width="'. $width .'" height="'. $height .'" + data="'. $video .'"> + <!--> <![endif]-->' . "\n"; // this will be executed by Internet Explorer - $output .= '<!--[if IE]> -<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="'. $node->video_scaled_x .'" height="'. $height .'" scale="tofit" > -<![endif]-->' . "\n"; + $output .= '<!--[if IE]> + <object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" + codebase="http://www.apple.com/qtactivex/qtplugin.cab" + width="'. $width .'" height="'. $height .'" scale="tofit" > + <![endif]-->' . "\n"; // params will be passed to both IE or not IE browsers //GMM: kioskmode enabled so users don't bypass download security video through player - $output .= '<param name="src" value="'. $url .'" /> - <param name="AUTOPLAY" value="'.(variable_get('video_autoplay', TRUE) ? 'true' : 'false').'" /> + $output .= '<param name="src" value="'. $video .'" /> + <param name="AUTOPLAY" value="'.(variable_get('video_autoplay', TRUE) ? TRUE : FALSE).'" /> <param name="KIOSKMODE" value="true" /> <param name="CONTROLLER" value="true" />' . "\n" - . _video_get_parameters($node) . - '<p>'. t('Your browser is not able to display this multimedia content.') .'</p> -</object>'; // only one </object> needed becouse only one opening tag has been parsed by browsers + . //_video_get_parameters($node) . + '<p>'. t('Your browser is not able to display this multimedia content.') .'</p> + </object>'; // only one </object> needed becouse only one opening tag has been parsed by browsers - - /* - $output = '<script language="JavaScript" type="text/javascript">'; - $output .= "InsertQuicktimeVideo('{$node->vidfile}','$height','{$node->video_scaled_x}');"; - $output .= '</script>'; - */ - - - $output = theme('video_format_play', $output, t('http://www.apple.com/quicktime/download'), - t('Link to QuickTime Download Page'), - t('Download latest Quicktime Player')); return $output; } @@ -275,27 +297,29 @@ data="'. $url .'"> * @return * string of content to display */ -function theme_video_play_realmedia($node) { - // Real's embeded player includes the controls - // in the height - $node->video_scaled_y += 40; - - $url = _video_get_fileurl($node->vidfile); +function theme_video_play_realmedia($element) { +// Real's embeded player includes the controls +// in the height + $video = file_create_url($element['#item']['filepath']); + $width = isset($element['#item']['data']['width']) ? $element['#item']['data']['width'] : ''; + $height = isset($element['#item']['data']['height']) ? $element['#item']['data']['height'] : ''; + $width = empty($width) ? '350px' : $width .'px'; + $height = empty($height) ? '285px' : $height .'px'; // this will be executed by not Internet Explorer browsers $output = '<!--[if !IE]> <--> -<object type="audio/x-pn-realaudio-plugin" width="'. $node->video_scaled_x .'" height="'. $node->video_scaled_y .'" -data="'. $url .'"> -<!--> <![endif]-->' . "\n"; + <object type="audio/x-pn-realaudio-plugin" width="'. $width .'" height="'. $height .'" + data="'. $video .'"> + <!--> <![endif]-->' . "\n"; // this will be executed by Internet Explorer - $output .= '<!--[if IE]> -<object type="audio/x-pn-realaudio-plugin" width="'. $node->video_scaled_x .'" height="'. $node->video_scaled_y .'" -classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" > -<![endif]-->' . "\n"; + $output .= '<!--[if IE]> + <object type="audio/x-pn-realaudio-plugin" width="'. $width .'" height="'. $height .'" + classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" > + <![endif]-->' . "\n"; // params will be passed to both IE or not IE browsers - $output .= '<param name="src" value="'. $url .'" /> + $output .= '<param name="src" value="'. $video .'" /> <param name="_ExtentX" value="7276" /> <param name="" value="3307" /> <param name="AUTOSTART" value="'.(variable_get('video_autoplay', TRUE) ? 'true' : 'false').'" /> @@ -309,14 +333,14 @@ classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" > <param name="CENTER" value="0" /> <param name="MAINTAINASPECT" value="1" /> <param name="BACKGROUNDCOLOR" value="#000000" />' - . _video_get_parameters($node) . - '<p>'. t('Your browser is not able to display this multimedia content.') .'</p> -</object>'; // only one </object> needed becouse only one opening tag has been parsed by browsers - + . //_video_get_parameters($node) . + '<p>'. t('Your browser is not able to display this multimedia content.') .'</p> + </object>'; // only one </object> needed becouse only one opening tag has been parsed by browsers +/* $output = theme('video_format_play', $output, t('http://www.real.com/'), t('Link to Real'), - t('Download latest Realmedia Player')); + t('Download latest Realmedia Player'));*/ return $output; } @@ -329,44 +353,38 @@ classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" > * @return * string of content to display */ -function theme_video_play_windowsmedia($node) { - // Windows Media's embeded player includes the controls in the height - $node->video_scaled_y += 68; - $url = _video_get_fileurl($node->vidfile); +function theme_video_play_windowsmedia($element) { +// Windows Media's embeded player includes the controls in the height + $video = file_create_url($element['#item']['filepath']); + $width = isset($element['#item']['data']['width']) ? $element['#item']['data']['width'] : ''; + $height = isset($element['#item']['data']['height']) ? $element['#item']['data']['height'] : ''; + $width = empty($width) ? '350px' : $width .'px'; + $height = empty($height) ? '285px' : $height .'px'; // this will be executed by not Internet Explorer browsers $output = '<!--[if !IE]> <--> -<object type="application/x-mplayer2" width="'. $node->video_scaled_x .'" height="'. $node->video_scaled_y .'" -data="'. $url .'"> -<!--> <![endif]-->' . "\n"; + <object type="application/x-mplayer2" width="'. $width .'" height="'. $height .'" + data="'. $video .'"> + <!--> <![endif]-->' . "\n"; // this will be executed by Internet Explorer - $output .= '<!--[if IE]> -<object type="application/x-oleobject" width="'. $node->video_scaled_x .'" height="'. $node->video_scaled_y .'" -classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" > -<![endif]-->' . "\n"; + $output .= '<!--[if IE]> + <object type="application/x-oleobject" width="'. $width .'" height="'. $height .'" + classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" > + <![endif]-->' . "\n"; // params will be passed to both IE or not IE browsers - $output .= '<param name="src" value="'. $url .'" /> - <param name="URL" value="'.$url.'" /> + $output .= '<param name="src" value="'. $video .'" /> + <param name="URL" value="'.$video.'" /> <param name="animationatStart" value="true" /> <param name="transparentatStart" value="true" /> <param name="autoStart" value="'.(variable_get('video_autoplay', TRUE) ? 'true' : 'false').'" /> <param name="showControls" value="true" /> <param name="loop" value="true" />' - . _video_get_parameters($node) . - '<p>'. t('Your browser is not able to display this multimedia content.') .'</p> -</object>'; // only one </object> needed becouse only one opening tag has been parsed by browsers - - - $output = "\n<div id=\"video-player\">\n" . $output; - $output .= "<p>\n". t('Problems viewing videos?'); - $output .= "<br />\n"; - $output .= l(t('Download latest Windows Media Player'), t('http://windowsupdate.microsoft.com/'), array('attributes' => array('title' => t('Link to Windows Update')), 'absolute' => TRUE)); - //GMM: add link to Windows Media Player plug-in for Firefox browsers - $output .= "<br />\n"; - $output .= l(t('Download the plug-in for Firefox'), t('http://support.mozilla.com/en-US/kb/Using+the+Windows+Media+Player+plugin+with+Firefox'), array('attributes' => array('title' => t('Link to Firefox Plug-in')), 'absolute' => TRUE)); - $output .= "\n</p> \n </div>\n"; + . //_video_get_parameters($node) . + '<p>'. t('Your browser is not able to display this multimedia content.') .'</p> + </object>'; // only one </object> needed becouse only one opening tag has been parsed by browsers + return $output; } @@ -382,10 +400,11 @@ classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" > * @return * string of content to display */ -function theme_video_play_ogg_theora($node) { +function theme_video_play_ogg_theora($element) { global $base_url; $cortado_location = variable_get('video_cortado', $base_url . '/cortado.jar'); - $url = _video_get_fileurl($node->vidfile); + //$url = _video_get_fileurl($node->vidfile); + $video = file_create_url($element['#item']['filepath']); $width = ($node->video_scaled_x ? $node->video_scaled_x : '425'); $height = ($node->video_scaled_y ? $node->video_scaled_y : '350'); @@ -406,7 +425,7 @@ function theme_video_play_ogg_theora($node) { <!--<![endif]--> <!-- IE and Konqueror browser need the archive param --> <param name="archive" value="' . $cortado_location . '" /> - <param name="url" value="' . $url . '"/> + <param name="url" value="' . $video . '"/> <param name="local" value="false" /> <param name="keepaspect" value="true" /> <param name="video" value="true" /> @@ -422,9 +441,8 @@ function theme_video_play_ogg_theora($node) { </strong> </object> '; - +/* $output = theme('video_format_play', $output, - t('http://java.com/download/'), t('Link to java.com'), t('Download Java')); + t('http://java.com/download/'), t('Link to java.com'), t('Download Java'));*/ return $output; -} - +}
\ No newline at end of file diff --git a/includes/video.views.inc b/includes/video.views.inc deleted file mode 100644 index 1f0682e..0000000 --- a/includes/video.views.inc +++ /dev/null @@ -1,135 +0,0 @@ -<?php -//$Id$ -/** -* Provides views data and enumerates handlers for video.module -* -* @return -* array - Enables support in the video module for views integration -* @author Glen Marianko Twitter@demoforum <glenm at demoforum dot com> -* @todo -**/ - -function video_views_data() { - // Basic table information. - // ---------------------------------------------------------------- - // views table - $data['video']['table']['group'] = t('Video'); - $data['video']['table']['join'] = array( - // ...to the node table - 'node' => array( - 'left_field' => 'nid', - 'field' => 'vid', - ), - ); - - // Fields that can be inserted into a view - // play counter - $data['video']['play_counter'] = array( - 'title' => t('Play count'), - 'help' => t('This will display the number of times this has been played.'), - 'field' => array( - 'handler' => 'views_handler_field_numeric', - 'click sortable' => TRUE, - ), - 'filter' => array( - 'handler' => 'views_handler_filter_numeric', - ), - 'sort' => array( - 'title' => t('Play count'), - 'help' => t('Sort by the number of video plays.'), - 'handler' => 'views_handler_sort', - ), - ); - $data['video']['download_counter'] = array( - 'title' => t('Download count'), - 'help' => t('This will display the number of times this has been downloaded.'), - 'field' => array( - 'handler' => 'views_handler_field_numeric', - 'click sortable' => TRUE, - ), - 'filter' => array( - 'handler' => 'views_handler_filter_numeric', - ), - 'sort' => array( - 'title' => t('Download count'), - 'help' => t('Sort by the number of video downloads.'), - 'handler' => 'views_handler_sort', - ), - ); - $data['video']['videox'] = array( - 'title' => t('Width (x)'), - 'help' => t('This will display the width (x) of the video'), - 'field' => array( - 'handler' => 'views_handler_field_numeric', - 'click sortable' => TRUE, - ), - 'filter' => array( - 'handler' => 'views_handler_filter_numeric', - ), - 'sort' => array( - 'handler' => 'views_handler_sort', - ), - ); - $data['video']['videoy'] = array( - 'title' => t('Height (y)'), - 'help' => t('This will display the height (y) of the video'), - 'field' => array( - 'handler' => 'views_handler_field_numeric', - 'click sortable' => TRUE, - ), - 'filter' => array( - 'handler' => 'views_handler_filter_numeric', - ), - 'sort' => array( - 'handler' => 'views_handler_sort', - ), - ); - $data['video']['playtime_seconds'] = array( - 'title' => t('Length'), - 'help' => t('This will display the play length of the video.'), - 'field' => array( - 'handler' => 'video_views_handler_field_playtime_seconds', - 'click sortable' => TRUE, - ), - 'filter' => array( - 'handler' => 'views_handler_filter_numeric', - ), - 'sort' => array( - 'title' => t('Length'), - 'help' => t('Sort by the video length.'), - 'handler' => 'views_handler_sort', - ), - ); - $data['video']['download_link'] = array( - 'real field' => 'vidfile', - 'title' => t('Download link'), - 'help' => t('This will display a download link if the node allows it.'), - 'field' => array( - 'handler' => 'video_views_handler_field_download', - 'click sortable' => FALSE, - ) - ); - $data['video']['play_link'] = array( - 'real field' => 'vidfile', - 'title' => t('Play link'), - 'help' => t('This will display a play link if the node allows it.'), - 'field' => array( - 'handler' => 'video_views_handler_field_play', - 'click sortable' => FALSE, - ), - ); - - // Add video_image support only if the video_image module is enabled - if (module_exists('video_image')) { - $data['video']['video_image'] = array( - 'real field' => 'vidfile', - 'title' => t('Thumbnail'), - 'help' => t('This will display the thumbnail image for the video.'), - 'field' => array( - 'handler' => 'video_views_handler_field_image', - 'click sortable' => FALSE, - ), - ); - } - return $data; -} diff --git a/includes/video.views_default.inc b/includes/video.views_default.inc deleted file mode 100644 index 271738e..0000000 --- a/includes/video.views_default.inc +++ /dev/null @@ -1,233 +0,0 @@ -<?php -//$Id$ -/** -* Implementation of hook_views_tables -* -* @return -* array - Enables default video module Video Tracker vie - * @author Glen Marianko Twitter@demoforum <glenm at demoforum dot com> -* @todo -**/ - -/** -* Provide a default view -* -* @return - array - of views -**/ -function video_views_default_views() { - $views = array(); - - // view definition (Views 2) - $view = new view; - $view->name = 'video_tracker'; - $view->description = 'Shows all recent video activity (table format)'; - $view->tag = ''; - $view->view_php = ''; - $view->base_table = 'node'; - $view->is_cacheable = FALSE; - $view->api_version = 2; - $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ - $handler = $view->new_display('default', 'Defaults', 'default'); - $handler->override_option('fields', array( - 'title' => array( - 'id' => 'title', - 'table' => 'node', - 'field' => 'title', - 'label' => 'Title', - 'link_to_node' => TRUE, - ), - 'changed' => array( - 'id' => 'changed', - 'table' => 'node', - 'field' => 'changed', - 'label' => 'Last Updated', - 'date_format' => 'small', - ), - 'name' => array( - 'id' => 'name', - 'table' => 'users', - 'field' => 'name', - 'label' => 'Author', - ), - 'playtime_seconds' => array( - 'label' => 'Play time', - 'alter' => array( - 'alter_text' => 0, - 'text' => '', - 'make_link' => 0, - 'path' => '', - 'link_class' => '', - 'alt' => '', - 'prefix' => '', - 'suffix' => '', - 'help' => '', - 'trim' => 0, - 'max_length' => '', - 'word_boundary' => 1, - 'ellipsis' => 1, - 'strip_tags' => 0, - 'html' => 0, - ), - 'exclude' => 0, - 'id' => 'playtime_seconds', - 'table' => 'video', - 'field' => 'playtime_seconds', - 'relationship' => 'none', - ), - 'video_image' => array( - 'id' => 'video_image', - 'table' => 'video', - 'field' => 'video_image', - 'label' => 'Preview / Play', - ), - )); - $handler->override_option('sorts', array( - 'changed' => array( - 'order' => 'ASC', - 'granularity' => 'second', - 'id' => 'changed', - 'table' => 'node', - 'field' => 'changed', - 'relationship' => 'none', - ), - )); - $handler->override_option('filters', array( - 'type' => array( - 'id' => 'type', - 'table' => 'node', - 'field' => 'type', - 'operator' => 'in', - 'value' => array( - '0' => 'video', - ), - ), - 'status' => array( - 'id' => 'status', - 'table' => 'node', - 'field' => 'status', - 'value' => '1', - ), - )); - $handler->override_option('access', array( - 'type' => 'none', - 'role' => array(), - 'perm' => '', - )); - $handler->override_option('cache', array( - 'type' => 'none', - )); - $handler->override_option('title', 'Recent video activity'); - $handler->override_option('header_format', '1'); - $handler->override_option('footer_format', '1'); - $handler->override_option('empty', 'There is no recent video activity'); - $handler->override_option('empty_format', '1'); - $handler->override_option('items_per_page', '20'); - $handler->override_option('use_pager', TRUE); - $handler->override_option('style_plugin', 'table'); - $handler->override_option('style_options', array( - 'columns' => array(), - 'default' => 'changed', - 'info' => array( - 'title' => array( - 'sortable' => TRUE, - ), - 'changed' => array( - 'sortable' => TRUE, - ), - ), - 'override' => FALSE, - 'order' => 'asc', - )); - $handler = $view->new_display('page', 'Page', 'page_1'); - $handler->override_option('path', 'video/tracker'); - $handler->override_option('menu', array( - 'type' => 'none', - 'title' => '', - 'description' => '', - 'weight' => 0, - 'name' => 'navigation', - )); - $handler->override_option('tab_options', array( - 'type' => 'none', - 'title' => '', - 'description' => '', - 'weight' => 0, - )); - $handler = $view->new_display('block', 'Block', 'block_1'); - $handler->override_option('fields', array( - 'title' => array( - 'label' => '', - 'alter' => array( - 'alter_text' => 0, - 'text' => '', - 'make_link' => 0, - 'path' => '', - 'link_class' => '', - 'alt' => '', - 'prefix' => '', - 'suffix' => '', - 'help' => '', - 'trim' => 0, - 'max_length' => '', - 'word_boundary' => 1, - 'ellipsis' => 1, - 'strip_tags' => 0, - 'html' => 0, - ), - 'link_to_node' => 1, - 'exclude' => 0, - 'id' => 'title', - 'table' => 'node', - 'field' => 'title', - 'override' => array( - 'button' => 'Use default', - ), - 'relationship' => 'none', - ), - 'video_image' => array( - 'label' => '', - 'alter' => array( - 'alter_text' => 0, - 'text' => '', - 'make_link' => 0, - 'path' => '', - 'link_class' => '', - 'alt' => '', - 'prefix' => '', - 'suffix' => '', - 'help' => '', - 'trim' => 0, - 'max_length' => '', - 'word_boundary' => 1, - 'ellipsis' => 1, - 'strip_tags' => 0, - 'html' => 0, - ), - 'exclude' => 0, - 'id' => 'video_image', - 'table' => 'video', - 'field' => 'video_image', - 'override' => array( - 'button' => 'Use default', - ), - 'relationship' => 'none', - ), - )); - $handler->override_option('use_ajax', TRUE); - $handler->override_option('items_per_page', 1); - $handler->override_option('use_pager', 'mini'); - $handler->override_option('style_plugin', 'grid'); - $handler->override_option('style_options', array( - 'grouping' => '', - 'columns' => '1', - 'alignment' => 'horizontal', - )); - $handler->override_option('block_description', 'Video Tracker'); - $handler->override_option('block_caching', -1); - - // recent video node activity view - $views[$view->name] = $view; - return $views; -} - diff --git a/includes/video_views_handler_field_download.inc b/includes/video_views_handler_field_download.inc deleted file mode 100644 index c01333e..0000000 --- a/includes/video_views_handler_field_download.inc +++ /dev/null @@ -1,37 +0,0 @@ -<?php -//$Id$ -/** -* Implementation of hook_views_tables -* -* @return -* array - Enables support in the video module for views integration - * @author Glen Marianko Twitter@demoforum <glenm at demoforum dot com> - * @todo -**/ - -/** - * Field handler to display the play length of the video. - * - * @ingroup views_field_handlers - */ -class video_views_handler_field_download extends views_handler_field { - /** - * Render field output to the browser. - */ - function render($values) { - return _video_views_handler_field_download($values); - } -} -/** -* Handler to to return the correct download link for the video in a field -**/ -function _video_views_handler_field_download($values) { - /* $str = NULL; - foreach($values as $key => $value) { - $str .= $key .'<br>'; - } - return $str; */ - if($values->node_type && $values->node_type != 'video') return NULL; - return l(t('Download'), "node/$values->nid/download", array()); -} - diff --git a/includes/video_views_handler_field_image.inc b/includes/video_views_handler_field_image.inc deleted file mode 100644 index fbbe905..0000000 --- a/includes/video_views_handler_field_image.inc +++ /dev/null @@ -1,74 +0,0 @@ -<?php -//$Id$ -/** -* Implementation of hook_views_tables -* -* @return -* array - Enables support in the video module for views integration - * @author Glen Marianko Twitter@demoforum <glenm at demoforum dot com> - * @todo -**/ - -/** - * Field handler to display the video preview thumbnail - * - * @ingroup views_field_handlers - */ -class video_views_handler_field_image extends views_handler_field { - /** - * Define options available for this field. - */ - function option_definition() { - $options = parent::option_definition(); - $options['img_type'] = array('default' => 'thumbnail'); - $options['disp_link'] = array('default' => TRUE); - return $options; - } - - /** - * Build option configuration form. - */ - function options_form(&$form, &$form_state) { - parent::options_form($form, $form_state); - - $form['img_type'] = array( - '#title' => t('Show image as'), - '#type' => 'select', - '#options' => array( - 'thumbnail' => t('Thumbnail'), - 'preview' => t('Preview'), - ), - '#default_value' => $this->options['img_type'], - ); - $form['disp_link'] = array( - '#title' => t('Link image to video'), - '#type' => 'checkbox', - '#default_value' => $this->options['disp_link'], - ); - - } -/** - * Render field output to the browser. - */ - function render($values) { - return _video_views_handler_field_image($values, $this->options['img_type'], $this->options['disp_link']); - } -} -/** -* Handler to render the preview image associated with a video -**/ -function _video_views_handler_field_image($values, $image_type, $linked) { - if($values->node_type && $values->node_type != 'video') return NULL; - $node = node_load($values->nid); - $output = NULL; - if($node->iid && $image = node_load($node->iid)) { - $image_html = NULL; - if($image != NULL && $image->type == 'image') { - $image_html = image_display($image, $image_type, array('class' => 'video_image_teaser')); - //Create a link with an image in it. - $output .= ($linked ? l($image_html, "node/$values->nid", array('html' => TRUE)) : $image_html); - $output .= '<br class="video_image_clear" />'; - } - } - return $output; -} diff --git a/includes/video_views_handler_field_play.inc b/includes/video_views_handler_field_play.inc deleted file mode 100644 index 1eac89e..0000000 --- a/includes/video_views_handler_field_play.inc +++ /dev/null @@ -1,31 +0,0 @@ -<?php -//$Id$ -/** -* Implementation of hook_views_tables -* -* @return -* array - Enables support in the video module for views integration - * @author Glen Marianko Twitter@demoforum <glenm at demoforum dot com> - * @todo -**/ - -/** - * Field handler to display the play length of the video. - * - * @ingroup views_field_handlers - */ -class video_views_handler_field_play extends views_handler_field { - /** - * Render field output to the browser. - */ - function render($values) { - return _video_views_handler_field_play($values); - } -} -/** -* Handler to to render the "Play" link field -**/ -function _video_views_handler_field_play($values) { - if($values->node_type && $values->node_type != 'video') return NULL; - return l(t('Play'), "node/$values->nid/play", array()); -} diff --git a/includes/video_views_handler_field_playtime_seconds.inc b/includes/video_views_handler_field_playtime_seconds.inc deleted file mode 100644 index c0efc93..0000000 --- a/includes/video_views_handler_field_playtime_seconds.inc +++ /dev/null @@ -1,76 +0,0 @@ -<?php -//$Id$ -/** -* Implementation of hook_views_tables -* -* @return -* array - Enables support in the video module for views integration - * @author Glen Marianko Twitter@demoforum <glenm at demoforum dot com> - * @todo -**/ - -/** - * Field handler to display the play length of the video. - * - * @ingroup views_field_handlers - */ -class video_views_handler_field_playtime_seconds extends views_handler_field { - /** - * Define options available for this field. - */ - function option_definition() { - $options = parent::option_definition(); - $options['time_type'] = array('default' => 'hms'); - return $options; - } - - /** - * Build option configuration form. - */ - function options_form(&$form, &$form_state) { - parent::options_form($form, $form_state); - - $form['time_type'] = array( - '#title' => t('Show playtime as'), - '#type' => 'select', - '#options' => array( - 'hms' => t('Hour:min:sec'), - 'sec' => t('Seconds'), - ), - '#default_value' => $this->options['time_type'], - ); - } - /** - * Render field output to the browser. - */ - function render($values) { - return _video_playtime_seconds($values, $this->options['time_type']); - } -} -/** -* Handler to to render the correct playtime for the video in a field -**/ -function _video_playtime_seconds($values, $type) { - if($values->node_type && $values->node_type != 'video') return NULL; - switch ($type) { - case 'hms': - $hms = _video_sec2hms($values->video_playtime_seconds); - - // Pad the minutes / seconds with a leading "0", if - // necessary - if ($hms['hours'] > 0) { - $hms['minutes'] = str_pad($hms['minutes'], 2, '0', STR_PAD_LEFT); - } - $hms['seconds'] = str_pad($hms['seconds'], 2, '0', STR_PAD_LEFT); - - $out = ''; - if ($hms['hours'] > 0) { - $out .= $hms['hours'].":"; - } - $out .= $hms['minutes'].":".$hms['seconds']; - return $out; - case 'sec': - default: - return $values->video_playtime_seconds; - } -} |