Debian Codegraph @

closure-library/closure/goog/ui/media/mediamodel.js

raw
1 // Copyright 2009 The Closure Library Authors. All Rights Reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS-IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 /**
16 * @fileoverview Provides the base media model consistent with the Yahoo Media
17 * RSS specification {@link http://search.yahoo.com/mrss/}.
18 */
19
20 goog.provide('goog.ui.media.MediaModel');
21 goog.provide('goog.ui.media.MediaModel.Category');
22 goog.provide('goog.ui.media.MediaModel.Credit');
23 goog.provide('goog.ui.media.MediaModel.Credit.Role');
24 goog.provide('goog.ui.media.MediaModel.Credit.Scheme');
25 goog.provide('goog.ui.media.MediaModel.Medium');
26 goog.provide('goog.ui.media.MediaModel.MimeType');
27 goog.provide('goog.ui.media.MediaModel.Player');
28 goog.provide('goog.ui.media.MediaModel.SubTitle');
29 goog.provide('goog.ui.media.MediaModel.Thumbnail');
30
31 goog.require('goog.array');
32 goog.require('goog.html.TrustedResourceUrl');
33
34
35
36 /**
37 * An base data value class for all media data models.
38 *
39 * MediaModels are exact matches to the fields defined in the Yahoo RSS media
40 * specification {@link http://search.yahoo.com/mrss/}.
41 *
42 * The current common data shared by medias is to have URLs, mime types,
43 * captions, descriptions, thumbnails and players. Some of these may not be
44 * available, or applications may not want to render them, so {@code null}
45 * values are allowed. {@code goog.ui.media.MediaRenderer} checks whether the
46 * values are available before creating DOMs for them.
47 *
48 * @param {string=} opt_url An optional URL of the media.
49 * @param {string=} opt_caption An optional caption of the media.
50 * @param {string=} opt_description An optional description of the media.
51 * @param {goog.ui.media.MediaModel.MimeType=} opt_type The type of the media.
52 * @param {goog.ui.media.MediaModel.Medium=} opt_medium The medium of the media.
53 * @param {number=} opt_duration The duration of the media in seconds.
54 * @param {number=} opt_width The width of the media in pixels.
55 * @param {number=} opt_height The height of the media in pixels.
56 * @constructor
57 */
58 goog.ui.media.MediaModel = function(
59 opt_url, opt_caption, opt_description, opt_type, opt_medium, opt_duration,
60 opt_width, opt_height) {
61 /**
62 * The URL of the media.
63 * @type {string|undefined}
64 * @private
65 */
66 this.url_ = opt_url;
67
68 /**
69 * The caption of the media.
70 * @type {string|undefined}
71 * @private
72 */
73 this.caption_ = opt_caption;
74
75 /**
76 * A description of the media, typically user generated comments about it.
77 * @type {string|undefined}
78 * @private
79 */
80 this.description_ = opt_description;
81
82 /**
83 * The mime type of the media.
84 * @type {goog.ui.media.MediaModel.MimeType|undefined}
85 * @private
86 */
87 this.type_ = opt_type;
88
89 /**
90 * The medium of the media.
91 * @type {goog.ui.media.MediaModel.Medium|undefined}
92 * @private
93 */
94 this.medium_ = opt_medium;
95
96 /**
97 * The duration of the media in seconds.
98 * @type {number|undefined}
99 * @private
100 */
101 this.duration_ = opt_duration;
102
103 /**
104 * The width of the media in pixels.
105 * @type {number|undefined}
106 * @private
107 */
108 this.width_ = opt_width;
109
110 /**
111 * The height of the media in pixels.
112 * @type {number|undefined}
113 * @private
114 */
115 this.height_ = opt_height;
116
117 /**
118 * A list of thumbnails representations of the media (eg different sizes of
119 * the same photo, etc).
120 * @type {Array<goog.ui.media.MediaModel.Thumbnail>}
121 * @private
122 */
123 this.thumbnails_ = [];
124
125 /**
126 * The list of categories that are applied to this media.
127 * @type {Array<goog.ui.media.MediaModel.Category>}
128 * @private
129 */
130 this.categories_ = [];
131
132 /**
133 * The list of credits that pertain to this media object.
134 * @type {!Array<goog.ui.media.MediaModel.Credit>}
135 * @private
136 */
137 this.credits_ = [];
138
139 /**
140 * The list of subtitles for the media object.
141 * @type {Array<goog.ui.media.MediaModel.SubTitle>}
142 * @private
143 */
144 this.subTitles_ = [];
145 };
146
147
148 /**
149 * The supported media mime types, a subset of the media types found here:
150 * {@link http://www.iana.org/assignments/media-types/} and here
151 * {@link http://en.wikipedia.org/wiki/Internet_media_type}
152 * @enum {string}
153 */
154 goog.ui.media.MediaModel.MimeType = {
155 HTML: 'text/html',
156 PLAIN: 'text/plain',
157 FLASH: 'application/x-shockwave-flash',
158 JPEG: 'image/jpeg',
159 GIF: 'image/gif',
160 PNG: 'image/png'
161 };
162
163
164 /**
165 * Supported mediums, found here:
166 * {@link http://video.search.yahoo.com/mrss}
167 * @enum {string}
168 */
169 goog.ui.media.MediaModel.Medium = {
170 IMAGE: 'image',
171 AUDIO: 'audio',
172 VIDEO: 'video',
173 DOCUMENT: 'document',
174 EXECUTABLE: 'executable'
175 };
176
177
178 /**
179 * The media player.
180 * @type {goog.ui.media.MediaModel.Player}
181 * @private
182 */
183 goog.ui.media.MediaModel.prototype.player_;
184
185
186 /**
187 * Gets the URL of this media.
188 * @return {string|undefined} The URL of the media.
189 */
190 goog.ui.media.MediaModel.prototype.getUrl = function() {
191 return this.url_;
192 };
193
194
195 /**
196 * Sets the URL of this media.
197 * @param {string} url The URL of the media.
198 * @return {!goog.ui.media.MediaModel} The object itself, used for chaining.
199 */
200 goog.ui.media.MediaModel.prototype.setUrl = function(url) {
201 this.url_ = url;
202 return this;
203 };
204
205
206 /**
207 * Gets the caption of this media.
208 * @return {string|undefined} The caption of the media.
209 */
210 goog.ui.media.MediaModel.prototype.getCaption = function() {
211 return this.caption_;
212 };
213
214
215 /**
216 * Sets the caption of this media.
217 * @param {string} caption The caption of the media.
218 * @return {!goog.ui.media.MediaModel} The object itself, used for chaining.
219 */
220 goog.ui.media.MediaModel.prototype.setCaption = function(caption) {
221 this.caption_ = caption;
222 return this;
223 };
224
225
226 /**
227 * Gets the media mime type.
228 * @return {goog.ui.media.MediaModel.MimeType|undefined} The media mime type.
229 */
230 goog.ui.media.MediaModel.prototype.getType = function() {
231 return this.type_;
232 };
233
234
235 /**
236 * Sets the media mime type.
237 * @param {goog.ui.media.MediaModel.MimeType} type The media mime type.
238 * @return {!goog.ui.media.MediaModel} The object itself, used for chaining.
239 */
240 goog.ui.media.MediaModel.prototype.setType = function(type) {
241 this.type_ = type;
242 return this;
243 };
244
245
246 /**
247 * Gets the media medium.
248 * @return {goog.ui.media.MediaModel.Medium|undefined} The media medium.
249 */
250 goog.ui.media.MediaModel.prototype.getMedium = function() {
251 return this.medium_;
252 };
253
254
255 /**
256 * Sets the media medium.
257 * @param {goog.ui.media.MediaModel.Medium} medium The media medium.
258 * @return {!goog.ui.media.MediaModel} The object itself, used for chaining.
259 */
260 goog.ui.media.MediaModel.prototype.setMedium = function(medium) {
261 this.medium_ = medium;
262 return this;
263 };
264
265
266 /**
267 * Gets the description of this media.
268 * @return {string|undefined} The description of the media.
269 */
270 goog.ui.media.MediaModel.prototype.getDescription = function() {
271 return this.description_;
272 };
273
274
275 /**
276 * Sets the description of this media.
277 * @param {string} description The description of the media.
278 * @return {!goog.ui.media.MediaModel} The object itself, used for chaining.
279 */
280 goog.ui.media.MediaModel.prototype.setDescription = function(description) {
281 this.description_ = description;
282 return this;
283 };
284
285
286 /**
287 * Gets the thumbnail urls.
288 * @return {Array<goog.ui.media.MediaModel.Thumbnail>} The list of thumbnails.
289 */
290 goog.ui.media.MediaModel.prototype.getThumbnails = function() {
291 return this.thumbnails_;
292 };
293
294
295 /**
296 * Sets the thumbnail list.
297 * @param {Array<goog.ui.media.MediaModel.Thumbnail>} thumbnails The list of
298 * thumbnail.
299 * @return {!goog.ui.media.MediaModel} The object itself, used for chaining.
300 */
301 goog.ui.media.MediaModel.prototype.setThumbnails = function(thumbnails) {
302 this.thumbnails_ = thumbnails;
303 return this;
304 };
305
306
307 /**
308 * Gets the duration of the media.
309 * @return {number|undefined} The duration in seconds.
310 */
311 goog.ui.media.MediaModel.prototype.getDuration = function() {
312 return this.duration_;
313 };
314
315
316 /**
317 * Sets duration of the media.
318 * @param {number} duration The duration of the media, in seconds.
319 * @return {!goog.ui.media.MediaModel} The object itself, used for chaining.
320 */
321 goog.ui.media.MediaModel.prototype.setDuration = function(duration) {
322 this.duration_ = duration;
323 return this;
324 };
325
326
327 /**
328 * Gets the width of the media in pixels.
329 * @return {number|undefined} The width in pixels.
330 */
331 goog.ui.media.MediaModel.prototype.getWidth = function() {
332 return this.width_;
333 };
334
335
336 /**
337 * Sets the width of the media.
338 * @param {number} width The width of the media, in pixels.
339 * @return {!goog.ui.media.MediaModel} The object itself, used for chaining.
340 */
341 goog.ui.media.MediaModel.prototype.setWidth = function(width) {
342 this.width_ = width;
343 return this;
344 };
345
346
347 /**
348 * Gets the height of the media in pixels.
349 * @return {number|undefined} The height in pixels.
350 */
351 goog.ui.media.MediaModel.prototype.getHeight = function() {
352 return this.height_;
353 };
354
355
356 /**
357 * Sets the height of the media.
358 * @param {number} height The height of the media, in pixels.
359 * @return {!goog.ui.media.MediaModel} The object itself, used for chaining.
360 */
361 goog.ui.media.MediaModel.prototype.setHeight = function(height) {
362 this.height_ = height;
363 return this;
364 };
365
366
367 /**
368 * Gets the player data.
369 * @return {goog.ui.media.MediaModel.Player|undefined} The media player data.
370 */
371 goog.ui.media.MediaModel.prototype.getPlayer = function() {
372 return this.player_;
373 };
374
375
376 /**
377 * Sets the player data.
378 * @param {goog.ui.media.MediaModel.Player} player The media player data.
379 * @return {!goog.ui.media.MediaModel} The object itself, used for chaining.
380 */
381 goog.ui.media.MediaModel.prototype.setPlayer = function(player) {
382 this.player_ = player;
383 return this;
384 };
385
386
387 /**
388 * Gets the categories of the media.
389 * @return {Array<goog.ui.media.MediaModel.Category>} The categories of the
390 * media.
391 */
392 goog.ui.media.MediaModel.prototype.getCategories = function() {
393 return this.categories_;
394 };
395
396
397 /**
398 * Sets the categories of the media
399 * @param {Array<goog.ui.media.MediaModel.Category>} categories The categories
400 * of the media.
401 * @return {!goog.ui.media.MediaModel} The object itself, used for chaining.
402 */
403 goog.ui.media.MediaModel.prototype.setCategories = function(categories) {
404 this.categories_ = categories;
405 return this;
406 };
407
408
409 /**
410 * Finds the first category with the given scheme.
411 * @param {string} scheme The scheme to search for.
412 * @return {goog.ui.media.MediaModel.Category} The category that has the
413 * given scheme. May be null.
414 */
415 goog.ui.media.MediaModel.prototype.findCategoryWithScheme = function(scheme) {
416 if (!this.categories_) {
417 return null;
418 }
419 var category = goog.array.find(this.categories_, function(category) {
420 return category ? (scheme == category.getScheme()) : false;
421 });
422 return /** @type {goog.ui.media.MediaModel.Category} */ (category);
423 };
424
425
426 /**
427 * Gets the credits of the media.
428 * @return {!Array<goog.ui.media.MediaModel.Credit>} The credits of the media.
429 */
430 goog.ui.media.MediaModel.prototype.getCredits = function() {
431 return this.credits_;
432 };
433
434
435 /**
436 * Sets the credits of the media
437 * @param {!Array<goog.ui.media.MediaModel.Credit>} credits The credits of the
438 * media.
439 * @return {!goog.ui.media.MediaModel} The object itself, used for chaining.
440 */
441 goog.ui.media.MediaModel.prototype.setCredits = function(credits) {
442 this.credits_ = credits;
443 return this;
444 };
445
446
447 /**
448 * Finds all credits with the given role.
449 * @param {string} role The role to search for.
450 * @return {!Array<!goog.ui.media.MediaModel.Credit>} An array of credits
451 * with the given role. May be empty.
452 */
453 goog.ui.media.MediaModel.prototype.findCreditsWithRole = function(role) {
454 var credits = goog.array.filter(
455 this.credits_, function(credit) { return role == credit.getRole(); });
456 return /** @type {!Array<!goog.ui.media.MediaModel.Credit>} */ (credits);
457 };
458
459
460 /**
461 * Gets the subtitles for the media.
462 * @return {Array<goog.ui.media.MediaModel.SubTitle>} The subtitles.
463 */
464 goog.ui.media.MediaModel.prototype.getSubTitles = function() {
465 return this.subTitles_;
466 };
467
468
469 /**
470 * Sets the subtitles for the media
471 * @param {Array<goog.ui.media.MediaModel.SubTitle>} subtitles The subtitles.
472 * @return {!goog.ui.media.MediaModel} The object itself.
473 */
474 goog.ui.media.MediaModel.prototype.setSubTitles = function(subtitles) {
475 this.subTitles_ = subtitles;
476 return this;
477 };
478
479
480
481 /**
482 * Constructs a thumbnail containing details of the thumbnail's image URL and
483 * optionally its size.
484 * @param {string} url The URL of the thumbnail's image.
485 * @param {goog.math.Size=} opt_size The size of the thumbnail's image if known.
486 * @constructor
487 * @final
488 */
489 goog.ui.media.MediaModel.Thumbnail = function(url, opt_size) {
490 /**
491 * The thumbnail's image URL.
492 * @type {string}
493 * @private
494 */
495 this.url_ = url;
496
497 /**
498 * The size of the thumbnail's image if known.
499 * @type {goog.math.Size}
500 * @private
501 */
502 this.size_ = opt_size || null;
503 };
504
505
506 /**
507 * Gets the thumbnail URL.
508 * @return {string} The thumbnail's image URL.
509 */
510 goog.ui.media.MediaModel.Thumbnail.prototype.getUrl = function() {
511 return this.url_;
512 };
513
514
515 /**
516 * Sets the thumbnail URL.
517 * @param {string} url The thumbnail's image URL.
518 * @return {!goog.ui.media.MediaModel.Thumbnail} The object itself, used for
519 * chaining.
520 */
521 goog.ui.media.MediaModel.Thumbnail.prototype.setUrl = function(url) {
522 this.url_ = url;
523 return this;
524 };
525
526
527 /**
528 * Gets the thumbnail size.
529 * @return {goog.math.Size} The size of the thumbnail's image if known.
530 */
531 goog.ui.media.MediaModel.Thumbnail.prototype.getSize = function() {
532 return this.size_;
533 };
534
535
536 /**
537 * Sets the thumbnail size.
538 * @param {goog.math.Size} size The size of the thumbnail's image.
539 * @return {!goog.ui.media.MediaModel.Thumbnail} The object itself, used for
540 * chaining.
541 */
542 goog.ui.media.MediaModel.Thumbnail.prototype.setSize = function(size) {
543 this.size_ = size;
544 return this;
545 };
546
547
548
549 /**
550 * Constructs a player containing details of the player's URL and
551 * optionally its size.
552 * @param {!goog.html.TrustedResourceUrl} url The URL of the player.
553 * @param {Object=} opt_vars Optional map of arguments to the player.
554 * @param {goog.math.Size=} opt_size The size of the player if known.
555 * @constructor
556 * @final
557 */
558 goog.ui.media.MediaModel.Player = function(url, opt_vars, opt_size) {
559 /**
560 * The player's URL.
561 * @type {!goog.html.TrustedResourceUrl}
562 * @private
563 */
564 this.trustedResourceUrl_ = url;
565
566 /**
567 * Player arguments, typically flash arguments.
568 * @type {Object}
569 * @private
570 */
571 this.vars_ = opt_vars || null;
572
573 /**
574 * The size of the player if known.
575 * @type {goog.math.Size}
576 * @private
577 */
578 this.size_ = opt_size || null;
579 };
580
581
582 /**
583 * Gets the player URL.
584 * @return {!goog.html.TrustedResourceUrl} The player's URL.
585 */
586 goog.ui.media.MediaModel.Player.prototype.getTrustedResourceUrl = function() {
587 return this.trustedResourceUrl_;
588 };
589
590
591 /**
592 * Gets the player URL.
593 * @return {string} The player's URL.
594 */
595 goog.ui.media.MediaModel.Player.prototype.getUrl = function() {
596 return this.trustedResourceUrl_.getTypedStringValue();
597 };
598
599
600 /**
601 * Sets the player URL.
602 * @param {!goog.html.TrustedResourceUrl} url The player's URL.
603 * @return {!goog.ui.media.MediaModel.Player} The object itself, used for
604 * chaining.
605 */
606 goog.ui.media.MediaModel.Player.prototype.setUrl = function(url) {
607 this.trustedResourceUrl_ = url;
608 return this;
609 };
610
611
612 /**
613 * Gets the player arguments.
614 * @return {Object} The media player arguments.
615 */
616 goog.ui.media.MediaModel.Player.prototype.getVars = function() {
617 return this.vars_;
618 };
619
620
621 /**
622 * Sets the player arguments.
623 * @param {Object} vars The media player arguments.
624 * @return {!goog.ui.media.MediaModel.Player} The object itself, used for
625 * chaining.
626 */
627 goog.ui.media.MediaModel.Player.prototype.setVars = function(vars) {
628 this.vars_ = vars;
629 return this;
630 };
631
632
633 /**
634 * Gets the size of the player.
635 * @return {goog.math.Size} The size of the player if known.
636 */
637 goog.ui.media.MediaModel.Player.prototype.getSize = function() {
638 return this.size_;
639 };
640
641
642 /**
643 * Sets the size of the player.
644 * @param {goog.math.Size} size The size of the player.
645 * @return {!goog.ui.media.MediaModel.Player} The object itself, used for
646 * chaining.
647 */
648 goog.ui.media.MediaModel.Player.prototype.setSize = function(size) {
649 this.size_ = size;
650 return this;
651 };
652
653
654
655 /**
656 * A taxonomy to be set that gives an indication of the type of media content,
657 * and its particular contents.
658 * @param {string} scheme The URI that identifies the categorization scheme.
659 * @param {string} value The value of the category.
660 * @param {string=} opt_label The human readable label that can be displayed in
661 * end user applications.
662 * @constructor
663 * @final
664 */
665 goog.ui.media.MediaModel.Category = function(scheme, value, opt_label) {
666 /**
667 * The URI that identifies the categorization scheme.
668 * @type {string}
669 * @private
670 */
671 this.scheme_ = scheme;
672
673 /**
674 * The value of the category.
675 * @type {string}
676 * @private
677 */
678 this.value_ = value;
679
680 /**
681 * The human readable label that can be displayed in end user applications.
682 * @type {string}
683 * @private
684 */
685 this.label_ = opt_label || '';
686 };
687
688
689 /**
690 * Gets the category scheme.
691 * @return {string} The category scheme URI.
692 */
693 goog.ui.media.MediaModel.Category.prototype.getScheme = function() {
694 return this.scheme_;
695 };
696
697
698 /**
699 * Sets the category scheme.
700 * @param {string} scheme The category's scheme.
701 * @return {!goog.ui.media.MediaModel.Category} The object itself, used for
702 * chaining.
703 */
704 goog.ui.media.MediaModel.Category.prototype.setScheme = function(scheme) {
705 this.scheme_ = scheme;
706 return this;
707 };
708
709
710 /**
711 * Gets the categor's value.
712 * @return {string} The category's value.
713 */
714 goog.ui.media.MediaModel.Category.prototype.getValue = function() {
715 return this.value_;
716 };
717
718
719 /**
720 * Sets the category value.
721 * @param {string} value The category value to be set.
722 * @return {!goog.ui.media.MediaModel.Category} The object itself, used for
723 * chaining.
724 */
725 goog.ui.media.MediaModel.Category.prototype.setValue = function(value) {
726 this.value_ = value;
727 return this;
728 };
729
730
731 /**
732 * Gets the label of the category.
733 * @return {string} The label of the category.
734 */
735 goog.ui.media.MediaModel.Category.prototype.getLabel = function() {
736 return this.label_;
737 };
738
739
740 /**
741 * Sets the label of the category.
742 * @param {string} label The label of the category.
743 * @return {!goog.ui.media.MediaModel.Category} The object itself, used for
744 * chaining.
745 */
746 goog.ui.media.MediaModel.Category.prototype.setLabel = function(label) {
747 this.label_ = label;
748 return this;
749 };
750
751
752
753 /**
754 * Indicates an entity that has contributed to a media object. Based on
755 * 'media.credit' in the rss spec.
756 * @param {string} value The name of the entity being credited.
757 * @param {goog.ui.media.MediaModel.Credit.Role=} opt_role The role the entity
758 * played.
759 * @param {goog.ui.media.MediaModel.Credit.Scheme=} opt_scheme The URI that
760 * identifies the role scheme.
761 * @constructor
762 * @final
763 */
764 goog.ui.media.MediaModel.Credit = function(value, opt_role, opt_scheme) {
765 /**
766 * The name of entity being credited.
767 * @type {string}
768 * @private
769 */
770 this.value_ = value;
771
772 /**
773 * The role the entity played.
774 * @type {goog.ui.media.MediaModel.Credit.Role|undefined}
775 * @private
776 */
777 this.role_ = opt_role;
778
779 /**
780 * The URI that identifies the role scheme
781 * @type {goog.ui.media.MediaModel.Credit.Scheme|undefined}
782 * @private
783 */
784 this.scheme_ = opt_scheme;
785 };
786
787
788 /**
789 * The types of known roles.
790 * @enum {string}
791 */
792 goog.ui.media.MediaModel.Credit.Role = {
793 UPLOADER: 'uploader',
794 OWNER: 'owner'
795 };
796
797
798 /**
799 * The types of known schemes.
800 * @enum {string}
801 */
802 goog.ui.media.MediaModel.Credit.Scheme = {
803 EUROPEAN_BROADCASTING: 'urn:ebu',
804 YAHOO: 'urn:yvs',
805 YOUTUBE: 'urn:youtube'
806 };
807
808
809 /**
810 * Gets the name of the entity being credited.
811 * @return {string} The name of the entity.
812 */
813 goog.ui.media.MediaModel.Credit.prototype.getValue = function() {
814 return this.value_;
815 };
816
817
818 /**
819 * Sets the value of the credit object.
820 * @param {string} value The value.
821 * @return {!goog.ui.media.MediaModel.Credit} The object itself.
822 */
823 goog.ui.media.MediaModel.Credit.prototype.setValue = function(value) {
824 this.value_ = value;
825 return this;
826 };
827
828
829 /**
830 * Gets the role of the entity being credited.
831 * @return {goog.ui.media.MediaModel.Credit.Role|undefined} The role of the
832 * entity.
833 */
834 goog.ui.media.MediaModel.Credit.prototype.getRole = function() {
835 return this.role_;
836 };
837
838
839 /**
840 * Sets the role of the credit object.
841 * @param {goog.ui.media.MediaModel.Credit.Role} role The role.
842 * @return {!goog.ui.media.MediaModel.Credit} The object itself.
843 */
844 goog.ui.media.MediaModel.Credit.prototype.setRole = function(role) {
845 this.role_ = role;
846 return this;
847 };
848
849
850 /**
851 * Gets the scheme of the credit object.
852 * @return {goog.ui.media.MediaModel.Credit.Scheme|undefined} The URI that
853 * identifies the role scheme.
854 */
855 goog.ui.media.MediaModel.Credit.prototype.getScheme = function() {
856 return this.scheme_;
857 };
858
859
860 /**
861 * Sets the scheme of the credit object.
862 * @param {goog.ui.media.MediaModel.Credit.Scheme} scheme The scheme.
863 * @return {!goog.ui.media.MediaModel.Credit} The object itself.
864 */
865 goog.ui.media.MediaModel.Credit.prototype.setScheme = function(scheme) {
866 this.scheme_ = scheme;
867 return this;
868 };
869
870
871
872 /**
873 * A reference to the subtitle URI for a media object.
874 * Implements the 'media.subTitle' in the rss spec.
875 *
876 * @param {string} href The subtitle's URI.
877 * to fetch the subtitle file.
878 * @param {string} lang An RFC 3066 language.
879 * @param {string} type The MIME type of the URI.
880 * @constructor
881 * @final
882 */
883 goog.ui.media.MediaModel.SubTitle = function(href, lang, type) {
884 /**
885 * The subtitle href.
886 * @type {string}
887 * @private
888 */
889 this.href_ = href;
890
891 /**
892 * The RFC 3066 language.
893 * @type {string}
894 * @private
895 */
896 this.lang_ = lang;
897
898 /**
899 * The MIME type of the resource.
900 * @type {string}
901 * @private
902 */
903 this.type_ = type;
904 };
905
906
907 /**
908 * Sets the href for the subtitle object.
909 * @param {string} href The subtitle's URI.
910 * @return {!goog.ui.media.MediaModel.SubTitle} The object itself.
911 */
912 goog.ui.media.MediaModel.SubTitle.prototype.setHref = function(href) {
913 this.href_ = href;
914 return this;
915 };
916
917
918 /**
919 * Get the href for the subtitle object.
920 * @return {string} href The subtitle's URI.
921 */
922 goog.ui.media.MediaModel.SubTitle.prototype.getHref = function() {
923 return this.href_;
924 };
925
926
927 /**
928 * Sets the language for the subtitle object.
929 * @param {string} lang The RFC 3066 language.
930 * @return {!goog.ui.media.MediaModel.SubTitle} The object itself.
931 */
932 goog.ui.media.MediaModel.SubTitle.prototype.setLang = function(lang) {
933 this.lang_ = lang;
934 return this;
935 };
936
937
938 /**
939 * Get the lang for the subtitle object.
940 * @return {string} lang The RFC 3066 language.
941 */
942 goog.ui.media.MediaModel.SubTitle.prototype.getLang = function() {
943 return this.lang_;
944 };
945
946
947 /**
948 * Sets the type for the subtitle object.
949 * @param {string} type The MIME type.
950 * @return {!goog.ui.media.MediaModel.SubTitle} The object itself.
951 */
952 goog.ui.media.MediaModel.SubTitle.prototype.setType = function(type) {
953 this.type_ = type;
954 return this;
955 };
956
957
958 /**
959 * Get the type for the subtitle object.
960 * @return {string} type The MIME type.
961 */
962 goog.ui.media.MediaModel.SubTitle.prototype.getType = function() {
963 return this.type_;
964 };