Package muntjac :: Package ui :: Module video
[hide private]
[frames] | no frames]

Source Code for Module muntjac.ui.video

 1  # Copyright (C) 2012 Vaadin Ltd.  
 2  # Copyright (C) 2012 Richard Lincoln 
 3  #  
 4  # Licensed under the Apache License, Version 2.0 (the "License");  
 5  # you may not use this file except in compliance with the License.  
 6  # You may obtain a copy of the License at  
 7  #  
 8  #     http://www.apache.org/licenses/LICENSE-2.0  
 9  #  
10  # Unless required by applicable law or agreed to in writing, software  
11  # distributed under the License is distributed on an "AS IS" BASIS,  
12  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13  # See the License for the specific language governing permissions and  
14  # limitations under the License. 
15   
16  from muntjac.ui.abstract_media import AbstractMedia 
17  from muntjac.terminal.gwt.client.ui.v_video import VVideo 
18   
19   
20 -class Video(AbstractMedia):
21 """The Video component translates into an HTML5 C{<video>} element and as 22 such is only supported in browsers that support HTML5 media markup. 23 Browsers that do not support HTML5 display the text or HTML set by calling 24 L{setAltText}. 25 26 A flash-player fallback can be implemented by setting HTML content allowed 27 (L{setHtmlContentAllowed} and calling L{setAltText} with the flash player 28 markup. An example of flash fallback can be found at the <a href= 29 "https://developer.mozilla.org/En/Using_audio_and_video_in_Firefox#Using_Flash" 30 >Mozilla Developer Network</a>. 31 32 Multiple sources can be specified. Which of the sources is used is selected 33 by the browser depending on which file formats it supports. See <a 34 href="http://en.wikipedia.org/wiki/HTML5_video#Table">wikipedia</a> for a 35 table of formats supported by different browsers. 36 37 @author: Vaadin Ltd 38 @author: Richard Lincoln 39 """ 40 41 CLIENT_WIDGET = None #CLientWidget(VVideo) 42
43 - def __init__(self, caption='', source=None):
44 """@param caption: 45 The caption for this video. 46 @param source: 47 The resource containing the video to play. 48 """ 49 self._poster = None 50 51 self.setCaption(caption) 52 self.setSource(source) 53 self.setShowControls(True)
54 55
56 - def setPoster(self, poster):
57 """Sets the poster image, which is shown in place of the video before 58 the user presses play. 59 """ 60 self._poster = poster
61 62
63 - def getPoster(self):
64 """@return The poster image.""" 65 return self._poster
66 67
68 - def paintContent(self, target):
69 super(Video, self).paintContent(target) 70 if self.getPoster() is not None: 71 target.addAttribute(VVideo.ATTR_POSTER, self.getPoster())
72