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

Source Code for Module muntjac.ui.audio

 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  """Translates into an HTML5 C{<audio>} element.""" 
17   
18  from muntjac.ui.abstract_media import AbstractMedia 
19   
20   
21 -class Audio(AbstractMedia):
22 """The Audio component translates into an HTML5 C{<audio>} element and as 23 such is only supported in browsers that support HTML5 media markup. 24 Browsers that do not support HTML5 display the text or HTML set by calling 25 L{setAltText}. 26 27 A flash-player fallback can be implemented by setting HTML content allowed 28 (L{setHtmlContentAllowed} and calling L{setAltText} with the flash player 29 markup. An example of flash fallback can be found at the <a href= 30 "https://developer.mozilla.org/En/Using_audio_and_video_in_Firefox#Using_Flash" 31 >Mozilla Developer Network</a>. 32 33 Multiple sources can be specified. Which of the sources is used is selected 34 by the browser depending on which file formats it supports. See <a 35 href="http://en.wikipedia.org/wiki/HTML5_video#Table">wikipedia</a> for a 36 table of formats supported by different browsers. 37 38 @author: Vaadin Ltd 39 @author: Richard Lincoln 40 """ 41 42 CLIENT_WIDGET = None #ClientWidget(VAudio) 43
44 - def __init__(self, caption='', source=None):
45 """@param caption: The caption of the audio component 46 @param source: The audio file to play. 47 """ 48 super(Audio, self).__init__() 49 50 self.setCaption(caption) 51 self.setSource(source) 52 self.setShowControls(True)
53