Changeset 945
- Timestamp:
- 04/22/10 12:19:35 (3 years ago)
- Location:
- trunk/html5/doc
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/html5/doc/api.rst
r944 r945 3 3 Player API 4 4 ========== 5 6 The HTML5 player contains a simple javascript API which can be used to: 7 8 * Request the various playback states (*position*, *volume*, *dimensions*). 9 * Control the player through a number of available methods (*play*, *pause*, *load*). 10 * Track the player state by listening to certain events (*time*, *volume*, *resize*). 11 12 Since the HML5 player is built using the jQuery, its API is using several conventions found in this framework. 13 14 Referencing a player 15 -------------------- 16 17 Before you can interact with the player, you need to be able to reference it (get a hold of it) from your javascript code. If you use a single player on the page, this is very simple: 18 19 .. code-block:: html 20 21 <video class="jwplayer" width="400" height="300" src="/static/video.mp4"> 22 <script type="text/javascript"> 23 var player = $.jwplayer(); 24 player.play(); 25 </script> 26 27 If you have multiple players on a page, you can reference a single player by giving each player a specific ID. Next, you use a `jQuery selector <http://api.jquery.com/category/selectors/>`_ to get to the player you want: 28 29 .. code-block:: html 30 31 <video class="jwplayer" id="player1" width="400" height="300" src="/static/video1.mp4"> 32 <video class="jwplayer" id="player2" width="400" height="300" src="/static/video2.mp4"> 33 34 <script type="text/javascript"> 35 var player = $.jwplayer("#player1"); 36 player.play(); 37 </script> 38 39 40 Requesting properties 41 --------------------- 42 43 The following player properties can be requested using javascript: 44 45 .. describe:: buffer () 46 47 The percentage of the videofile that is downloaded to the page. Can be **0** to **100**. 48 49 .. describe:: duration () 50 51 The duration of the video file, in seconds. This will not be available on startup, but as of the moment the metadata of a video is loaded. 52 53 .. describe:: fullscreen () 54 55 The fullscreen state of the player. Can be **true** or **false**. 56 57 .. note:: Current browsers do not support true fullscreen, like Flash or Silverlight do. The fullscreen mode of the HTML5 player will rather be a full-browser-screen. 58 59 .. describe:: height () 60 61 The height of the player, in pixels. 62 63 64 .. describe:: mute () 65 66 The sound muting state of the player. Can be **true** (no sound) or **false**. 67 68 .. note:: *Volume* and *mute* are separate properties. This allows the player to switch to the previously used volume when the player is muted and then unmuted. 69 70 .. describe:: position () 71 72 The current playback position of the video, in seconds. 73 74 .. describe:: state () 75 76 The current playback state of the player. Can be: 77 78 * **idle**: Video not playing, video not loaded. 79 * **buffering**: Video is loading, the player is waiting for enough data to start playback. 80 * **playing**: Video is playing. 81 * **paused** Video has enough data for playback, but the user has paused the video. 82 83 .. describe:: volume () 84 85 The audio volume percentage of the player, can be **0** to **100**. 86 87 .. describe:: width () 88 89 The width of the player, in pixels. 90 91 92 Here's how to request a player property: 93 94 .. code-block:: html 95 96 <video class="jwplayer" width="400" height="300" src="/static/video.mp4"> 97 98 <p onclick="alert($.jwplayer().volume())">Get player volume</p> 99 100 101 Calling methods 102 --------------- 103 104 The player exposes a list of methods you can use to control it from javascript: 105 106 .. describe:: fullscreen (state) 107 108 Change fullscreen playback. The state can be **true** or **false**. 109 110 .. note:: Current browsers do not support true fullscreen, like Flash or Silverlight do. The fullscreen mode of the HTML5 player will rather be a full-browser-screen. 111 112 .. describe:: load (url) 113 114 Load a new video into the player. The **url** should be a valid hyperlink to the video file (e.g. **/static/video/holiday.mp4**). The file can be in any :ref:`supported media type <formats>`. 115 116 .. describe:: mute (state) 117 118 Change the mute state of the player. The *state* can be **true** or **false**. 119 120 .. describe:: pause () 121 122 Pause playback of the video. If the video is already *paused* (or *idle*), this method does nothing. 123 124 .. describe:: play () 125 126 Start playback of the video. If the video is already *playing* (or *buffering*), this method does nothing. 127 128 .. describe:: resize (width,height) 129 130 Resize the player to a certain **width** and **height** (in pixels). Use this to e.g. toggle between a small and large player view like Youtube does. 131 132 .. describe:: seek (position) 133 134 Seek to and playing the video from a certain *position*, in seconds (e.g. **120** for 2 minutes in). If the player is *paused* or *idle*, it will start playback. 135 136 .. describe:: stop () 137 138 Stop playing the video, unload the video and display the poster frame. The player proceeds to the **idle** state. 139 140 .. describe:: volume (volume) 141 142 Set the player audio volume percentage, a number between 0 and 100. When changing the volume while the player is muted, it will also automatically be unmuted. 143 144 145 Here's how to invoke a player method: 146 147 .. code-block:: html 148 149 <video class="jwplayer" width="400" height="300" src="/static/video.mp4"> 150 <ul> 151 <li> onclick="$.jwplayer().play()">play the video</li> 152 <li> onclick="$.jwplayer().pause()">pause the video</li> 153 <li> onclick="$.jwplayer().seek(0)">play from the beginning of the video</li> 154 </ul> -
trunk/html5/doc/conf.py
r944 r945 23 23 # Add any Sphinx extension module names here, as strings. They can be extensions 24 24 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. 25 # extensions = ['sphinx.ext.todo','rst2pdf.pdfbuilder'] 25 26 extensions = ['sphinx.ext.todo'] 26 27 … … 193 194 # If false, no module index is generated. 194 195 #latex_use_modindex = True 196 197 # -- Options for PDF output -------------------------------------------------- 198 199 # Grouping the document tree into PDF files. List of tuples 200 # (source start file, target name, title, author, options). 201 # 202 # If there is more than one author, separate them with \\. 203 # For example: r'Guido van Rossum\\Fred L. Drake, Jr., editor' 204 # 205 # The options element is a dictionary that lets you override 206 # this config per-document. 207 # For example, 208 # ('index', u'MyProject', u'My Project', u'Author Name', 209 # dict(pdf_compressed = True)) 210 # would mean that specific document would be compressed 211 # regardless of the global pdf_compressed setting. 212 pdf_documents = [ 213 ('index', u'JWPlayerHTML5', u'JW Player for HTML5', u'Zachary Ozer, Jeroen Wijering'), 214 ] 215 # A comma-separated list of custom stylesheets. Example: 216 pdf_stylesheets = ['sphinx','kerning','a4'] 217 # Create a compressed PDF 218 # Use True/False or 1/0 219 # Example: compressed=True 220 #pdf_compressed = False 221 # A colon-separated list of folders to search for fonts. Example: 222 # pdf_font_path = ['/usr/share/fonts', '/usr/share/texmf-dist/fonts/'] 223 # Language to be used for hyphenation support 224 #pdf_language = "en_US" 225 # Mode for literal blocks wider than the frame. Can be 226 # overflow, shrink or truncate -
trunk/html5/doc/embed.rst
r944 r945 44 44 --------------------- 45 45 46 When the player detects that none of the source videos can be played, it can fall back to an instance of the `JW Player for Flash < www.longtailvideo.com/players/jw-flv-player/>`_:46 When the player detects that none of the source videos can be played, it can fall back to an instance of the `JW Player for Flash <http://www.longtailvideo.com/players/jw-flv-player/>`_: 47 47 48 48 .. code-block:: html
Note: See TracChangeset
for help on using the changeset viewer.
