V3/Multimedia.pm

filter: Statementstmt 100% 18 / 18 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 100% 21 / 21 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« V3/Server/Version.pm ↑ Summary V3/Presentation.pm »
1 package Bb::Collaborate::V3::Multimedia;
2 6 ▶use warnings; use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 6 ▶use Mouse;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 6 extends 'Bb::Collaborate::V3::_Content';
7  
8 =head1 NAME
9  
10 Bb::Collaborate::V3::Multimedia - Multimedia entity class
11  
12 =head1 DESCRIPTION
13  
14 This command uploads supported multimedia files into your ELM repository for use by your Collaborate sessions.
15  
16 Once uploaded, you will need to "attach" the file to one or more Collaborate
17 sessions using the L<Bb::Collaborate::V3::Session> C<set_multimedia()>
18 method.
19  
20 =cut
21  
22 6 __PACKAGE__->entity_name('Multimedia');
23  
24 =head1 PROPERTIES
25  
26 =head2 multimediaId (Int)
27  
28 Identifier of the multimedia file in the ELM repository.
29  
30 =cut
31  
32 6 has 'multimediaId' => (is => 'rw', isa => 'Int', required => 1);
33 6 __PACKAGE__->primary_key('multimediaId');
34 6 __PACKAGE__->params(
35 content => 'Str',
36 filename => 'Str',
37 sessionId => 'Int',
38 );
39  
40 =head2 description (Str)
41  
42 A description of the multimedia content.
43  
44 =cut
45  
46 6 has 'description' => (is => 'rw', isa => 'Str');
47  
48 =head2 size (Int)
49  
50 The size of the multimedia file (bytes), once uploaded to the ELM repository.
51  
52 =cut
53  
54 6 has 'size' => (is => 'rw', isa => 'Int');
55  
56 =head2 creatorId (Str)
57  
58 The identifier of the owner of the multimedia file.
59  
60 =cut
61  
62 6 has 'creatorId' => (is => 'rw', isa => 'Str');
63  
64 =head2 filename (Str)
65  
66 The name of the multimedia file including the file extension.
67 Collobrate supports the following multimedia file types:
68  
69 =over 4
70  
71 =item * MPEG files: C<.mpeg>, C<.mpg>, C<.mpe>, C<.m4v>, C<.mp4>
72  
73 =item * QuickTime files: C<.mov>, C<.qt>
74  
75 =item * Windows Media files: C<.wmv>
76  
77 =item * Flash files: C<.swf>
78  
79 =item * Audio files: C<.mp3>
80  
81 =back
82  
83 The filename must be less than 64 characters (including any file extensions).
84  
85 =cut
86  
87 =head1 METHODS
88  
89 =cut
90  
91 =head2 upload
92  
93 Uploads content and creates a new multimedia resource.
94  
95 You can either upload a file:
96  
97 # 1. upload a local file
98 my $multimedia1 = Bb::Collaborate::V3::Multimedia->upload('c:\\Documents\intro.wav');
99  
100 or source binary content:
101  
102 # 2. source our own binary content
103 open (my $fh, '<', $multimedia_path)
104 or die "unable to open $multimedia_path: $!";
105 $fh->binmode;
106  
107 my $content = do {local $/ = undef; <$fh>};
108 die "no multimedia data: $multimedia_path"
109 unless ($content);
110  
111 my $multimedia2 = Bb::Collaborate::V3::Multimedia->upload(
112 {
113 filename => 'whoops.wav',
114 creatorId => 'alice',
115 content => $content,
116 description => 'Caravan destroys service station',
117 },
118 );
119  
120 You can assign multiple multimedia items to a session:
121  
122 $some_session->set_multimedia( [$multimedia1, $multimedia2] );
123  
124 =cut
125  
126 =head2 list
127  
128 my $session_presentations = Bb::Collaborate::V3::Multimedia->list(
129 filter => {sessionId => $my_session->id}
130 );
131  
132 Lists multimedia. You will need to provide a filter that contains at least one
133 of: C<sessionId>, C<creatorId>, C<description> or C<multimediaId>.
134  
135 =cut
136  
137 =head2 delete
138  
139 $multimedia->delete;
140  
141 Deletes multimedia content from the server and removes it from any associated sessions.
142  
143 =cut
144  
145 6 1;
« V3/Server/Version.pm ↑ Summary V3/Presentation.pm »