aboutsummaryrefslogtreecommitdiff
path: root/types/video_url/video_url.module
blob: 0e92ec60d759dc1b8e718088c65db77042b95e86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php
//$Id$
/**
 * @file
 * Enable Path or URL support for video module.
 *
 * @author Fabio Varesano <fvaresano at yahoo dot it>
 * @author Heshan Wanigasooriya <heshan at heidisoft.com><heshanmw at gmail dot com>
 * @todo
 */


/**
 * Implementation of hook_menu
*/
function video_url_menu() {
  $items = array();
  $maycache=true;
  if($maycache) {
    $items['node/add/video/url'] = array(
      'title' => 'URL',
      'access arguments' => array('create video')
    );
  }

  return $items;
}


/**
 * Implementation of hook_v_help
*/
function video_url_v_help() {

  $help = array();
  $help['url']['data'] = '<b>' . t('Url support') . '</b>';
  $help['url']['children'] = array(t('You can link to any video file on the Internet.'));

  return $help;
}


/**
 * Implementation of hook_v_info()
*/
function video_url_v_info() {
  $info['url'] = array(
    '#name' => 'URL Video',
    '#description' => t('Post a video available on the Internet to this website.'),
    '#downloadable' => TRUE,
    '#autothumbable' => FALSE,
    '#autoresolution' => FALSE,
    '#autoplaytime' => FALSE,
  );

  return $info;
}


/**
 * Implementation of hook_v_form()
*/
function video_url_v_form(&$node, &$form) {

  $form['video']['vidfile'] = array(
    '#type' => 'textfield',
    '#title' => t('URL to the video'),
    '#default_value' => $node->vidfile,
    '#maxlength' => 700,
    '#required' => TRUE,
    '#weight' => -20,
    '#description' => t('Insert the URL to the video file. This shuold be something similar to <em>http://www.example.com/videos/myvideo.flv</em>') . ' ' . l(t('More information.'), 'video/help', array('fragment' => 'videofile')));

  return $form;
}


/**
 * implementation of hook_v_validate
*/
function video_url_v_validate($node) {
  // Can you suggest a validation?
  // validation should allow URLs, relative paths but also streaming servers URLs
}

/**
 * Implementation of hook_v_play
*/
function video_url_v_play($node) {
  module_load_include('inc', 'video', 'includes/common');
  return _video_common_get_player($node);
}


/**
 * Implements the hook_v_download
*/
function video_url_v_download($node) {
    $url = _video_get_fileurl($node->vidfile);
    
    header("Location: $url"); //Redirect to the video file URL.
}