Warning: HTML preview using PygmentsRenderer failed (TypeError: function() takes at least 2 arguments (0 given))

source: plugins/livestream/js/doc/guides/overview.rst @ 1621

Revision 1621, 8.0 KB checked in by jeroen, 2 years ago (diff)

added docs to livestream plugin

Line 
1.. _overview:
2
3Introduction
4============
5
6**The livestream plugin is a fairly straightforward tool aimed at offering a smoother user experience around live events. It sits on top of the player, displaying state messages to the user.**
7
8Messages
9--------
10
11The plugin displays a message if playback is in any of the following states:
12
13* The live event hasn't started yet (the plugin displays a **countdown** message).
14* The live event was interrupted (the plugin displays a **reconnecting** message).
15* The live event has ended (the plugin displays an **event ended** message).
16
17Here is an image containing an example of each state:
18
19.. image:: ../assets/states.png
20   :alt: The three available messages in this plugin
21
22Reconnecting
23------------
24
25The interruption of a live event is automatically detected by the plugin. This includes the following scenarios:
26
27* The upload application (e.g. `FMLE <http://www.adobe.com/products/flashmediaserver/flashmediaencoder/>`_) is gracefully stopped.
28* The upload application (e.g. `FMLE <http://www.adobe.com/products/flashmediaserver/flashmediaencoder/>`_) is crashed.
29* The streaming server (e.g. `Wowza <http://www.wowzamedia.com/>`_) is gracefully stopped.
30* The streaming server (e.g. `Wowza <http://www.wowzamedia.com/>`_) is crashed.
31* The internet connection from the client is lost.
32
33If playback is interrupted and the current time is still before the event ending, the **reconnecting** message is displayed. The plugin attempts to reconnect to the server every ten seconds, until a connection is established again.
34
35If playback is interrupted and the current time is beyond the event ending, the plugin displays the **event ended** message.
36
37Compatibility
38-------------
39
40This plugin is written in JavaScript and therefore compatible with JW Player 5.5+ and HTML5. Only the `JW Embedder method <http://www.longtailvideo.com/support/jw-player/jw-player-for-flash-v5/15995/jw-embedder-reference-guide>`_ can be used for embedding this plugin; SWFObject and embed/object are not supported.
41
42The plugin is specifically tested with `Flash Media Server <http://www.adobe.com/products/flashmediaserver/>`_ and `Wowza Media Server <http://www.wowzamedia.com/>`_. With the latter, simultaneous live streaming to Flash + iOS (iPad/iPhone) is supported (see below).
43
44
45
46Configuration
47=============
48
49The livestream plugin has three configuration options:
50
51.. describe:: start
52
53   Start date and time of the live event, as a unix timestamp. Since a timestamp is inserted, the plugin will be timezone-agnostic. `Visit this page <http://www.timestampgenerator.com/>`_ to quickly generate a timestamp for a certain date.
54   
55   The plugin will compare the current time with the start date. If the start date hasn't arrived, the plugin will show a countdown timer. If the start date has arrived, the live stream immediately starts.
56   
57   The default *start* is **0** (the plugin assumes the event has started).
58
59.. describe:: end
60
61   End date and time of the live event, as a unix timestamp. Since a timestamp is inserted, the plugin will be timezone-agnostic. `Visit this page <http://www.timestampgenerator.com/>`_ to quickly generate a timestamp for a certain date.
62   
63   The plugin will compare the current time with the end date. If the end date already passed, the plugin will show an *event ended* message. If the end date hasn't arrived, the live stream immediately starts.
64   
65   The default *end* is **9999999999** (the plugin assumes the event will last forever).
66
67.. describe:: title
68
69   The event title the plugin displays in its messaging window. Any title is accepted, but do note the length of the title is restricted to whatever fits on one line. Whichever title looks best will depend upon the combination of title length and player width. We recommend a player width between 400 and 800 pixels.
70   
71   The default *title* is **Live event**.
72
73Example
74-------
75
76Here is an example page with a basic configuration of the livestream plugin. This example presumes you host the plugin (*livestream.js*) yourself:
77
78.. code-block:: html
79
80    <html>
81    <head>
82        <script type="text/javascript" src="assets/jwplayer.js"></script>
83    </head>
84    <body>
85        <div id='player'>You need Flash to play this stream</div>
86        <script type='text/javascript'>
87            jwplayer("player").setup({
88                file:'livestream',
89                height: 270,
90                flashplayer: '/assets/player.swf',
91                plugins: {
92                    '/assets/livestream.js': {
93                        end: 1299081600,
94                        start: 1299078000,
95                        title: 'Swimming Championships 2011, Finals'
96                    }
97                },
98                streamer: 'rtmp://example.com/live',
99                width: 480
100            });
101        </script>
102    </body>
103    </html>
104
105
106
107Streaming to iOS
108================
109
110When using the `Wowza Media Server <http://www.wowzamedia.com/>`_ for streaming, it is possible to make your event available to both Flash and iOS at the same time.
111
112The livestream plugin will display the **countdown** and **event ended** messages on iOS (tested on iPad). Unfortunately, automated reconnection is not possible, because:
113
114* iOS doesn't send out an event on stream interruptions.
115* iOS doesn't allow the *play()* API call.
116
117Users have to reconnect themselves by pressing the play icon that appears over the video when a stream disconnects.
118
119Ingestion
120---------
121
122For ingestion, it's important to use the right encoding settings:
123
124* iOS **requires** H264 video and AAC audio.
125* For compatibility with the iPhone 3G(s), make sure your video is Baseline, max level 3.1.
126
127Here's a screenshot with recommended settings. Dial back the resolution and bitrate (e.g. to 480x272px, 400kbps) if your outbound connection is having trouble sending the stream:
128
129.. image:: ../assets/fmle.png
130   :alt: Recommended FMLE settings for streaming to iOS.
131
132Streaming
133---------
134
135A default setup of the Wowza Media Server 2 is correctly configured to do RTMP + iOS streaming. Please refer to the `QuickStart Guide <http://www.wowzamedia.com/forums/content.php?217>`_ for more details.
136
137If you don't own a Wowza Media Server (or server for that matter), take a look at our `blog post on Wowza EC2 <http://www.longtailvideo.com/support/blog/17376/live-streaming-using-wowza-ec2>`_. It explains how to run a Wowza server by the hour off Amazon's EC2 service.
138
139Embedding
140---------
141
142On the embedding side, one change needs to be made to the basic example shown above. Instead of setting the RTMP file/streamer as a global option, they should be made unique to the player's **flash** mode. Next, the iOS compatible stream (always under *STREAMNAME/playlist.m3u8*) needs to get set for the **html5** mode:
143
144.. code-block:: html
145
146    <html>
147    <head>
148        <script type="text/javascript" src="/assets/jwplayer.js"></script>
149    </head>
150    <body>
151        <div id="player">You need Flash or iOS to play this stream</div>
152        <script type="text/javascript">
153            jwplayer("player").setup({
154                height: 270,
155                players: [{
156                    config: {
157                        file:'livestream',
158                        streamer:'rtmp://example.com/live'
159                    },
160                    type: 'flash',
161                    src: '/assets/player.swf'
162                },{
163                    config: {
164                        file: 'http://example.com:1935/live/teststream/playlist.m3u8'
165                    },
166                    type: 'html5'
167                }],
168                plugins: {
169                    '/assets/livestream.js': {
170                        end: 1299081600,
171                        start: 1299078000,
172                        title: 'Swimming Championships 2011, Finals'
173                    }
174                },
175                width: 480
176            });
177        </script>
178    </body>
179    </html>
180
181This configuration will playback the RTMP stream for any browser that supports Flash (desktops/Android) and the M3U8 stream for any iOS browser (iPad/iPhone). On other browsers, the fallback message in the <div> (*you need Flash or iOS*) stays untouched.
Note: See TracBrowser for help on using the repository browser.