1: <?php
2: /**
3: * Videos methods
4: *
5: * Copyright 2009-2012 Horde LLC (http://www.horde.org/)
6: *
7: * @author Michael J. Rubinsky <mrubinsk@horde.org>
8: * @category Horde
9: * @package Service_Facebook
10: */
11: class Horde_Service_Facebook_Videos extends Horde_Service_Facebook_Base
12: {
13: /**
14: * Uploads a video.
15: *
16: * @param string $file The location of the video on the local filesystem.
17: * @param string $title (Optional) A title for the video. Titles over 65 characters in length will be truncated.
18: * @param string $description (Optional) A description for the video.
19: *
20: * @return array An array with the video's ID, title, description, and a link to view it on Facebook.
21: */
22: public function upload($file, $title = null, $description = null)
23: {
24: // Session key is *required*
25: if (!$skey = $this->_facebook->auth->getSessionKey()) {
26: throw new Horde_Service_Facebook_Exception('session_key is required',
27: Horde_Service_Facebook_ErrorCodes::API_EC_SESSION_REQUIRED);
28: }
29:
30: return $this->_facebook->call_upload_method('facebook.video.upload',
31: array('title' => $title,
32: 'description' => $description,
33: 'session_key' => $skey),
34: $file,
35: Horde_Service_Facebook::getFacebookUrl('api-video') . '/restserver.php');
36: }
37:
38: /**
39: * Returns an array with the video limitations imposed on the current session's
40: * associated user. Maximum length is measured in seconds; maximum size is
41: * measured in bytes.
42: *
43: * @return array Array with "length" and "size" keys
44: */
45: public function &getUploadLimits()
46: {
47: // Session key is *required*
48: if (!$skey = $this->_facebook->auth->getSessionKey()) {
49: throw new Horde_Service_Facebook_Exception('session_key is required',
50: Horde_Service_Facebook_ErrorCodes::API_EC_SESSION_REQUIRED);
51: }
52:
53: return $this->_facebook->callMethod('facebook.video.getUploadLimits',
54: array('session_key' => $skey));
55: }
56:
57: }