The RealText broadcast feature lets you stream live broadcasts of RealText over a network. You can use it, for example, to broadcast a live stock ticker feed. To set up a text broadcast, you create a broadcast application that adds RealText mark-up to a text feed. You then integrate the broadcast application with the RealText Broadcast Library through a single system interface. That library takes care of the overhead of integrating with the standard RealSystem Remote Broadcast Library and a RealSystem broadcast plug-in, which manages the connection to RealServer.
![]() |
Additional Information |
---|
For information on RealText mark-up, see RealText Authoring Guide, available in HTML or PDF format from http://service.real.com/help/library/index.html. The bundled HTML download of this manual contains a compiled application that you can use to broadcast RealText. You need to build a new application with this SDK only if that application does not fit your needs. |
The following table lists the components you use to broadcast RealText with RealSystem. These components are included with a RealServer G2 installation.
Suppose that the live broadcast has the following URL:
rtsp://www.real.com/encoder/ticker
When the broadcast begins, the broadcast application connects to the RealText Broadcast Library, passing it the name of the live broadcast "file" (ticker), as well as identifying which broadcast plug-in to use. When the first client requests the live feed, RealServer determines which broadcast plug-in to use based on the URL's mount point (/encoder/). RealServer's FSMount
configuration parameter ties the mount point to a specific broadcast plug-in.
![]() |
Additional Information |
---|
See "FSMount Parameter". |
The RealText broadcast application uses the following interface:
IRMALiveText
. Header file: rmalvtxt.h
. The RealText Broadcast Library implements this interface. The broadcast application uses this interface to send window parameters, text, and mark-up to the library. There is no response interface.
The following sections explain how the text broadcast application interacts with the RealText Broadcast Library. The sample files included with this SDK illustrate many of these features. You can use the sample files as a starting point for building your own broadcast application.
When a RealText broadcast application starts up, it performs these actions:
CreateLiveText
process address, as shown in this extract from the sample file:
m_fpCreateLiveText = (FPRMCREATELIVETEXT) GetProcAddress(hDllRtlive,
"CreateLiveText");
CreateLiveText
function to create a live text encoding object:
if(PNR_OK == m_fpCreateLiveText((IRMALiveText**) &pLiveTextEncoder))
IRMALiveText::InitLiveText
to pass the live text object the following parameters.
IRMALiveText::EncoderIsInitialized
, which returns a Boolean value, to determine if the library is initialized and ready to receive text.
Before sending data, the broadcast application can define RealText <window>
tag properties. Because this tag is typically not included in a live broadcast, the application calls the following IRMALiveText
methods to set the properties. If the application does not use one of these methods, the property's default value is used:
IRMALiveText::SetBackgroundColor
Controls the window background color.
IRMALiveText::SetDoLooping
Determines whether looping occurs.
IRMALiveText::SetHyperlinkInfo
Specifies whether hyperlinks are underlined and sets the hyperlink color.
IRMALiveText::SetTextMotion
Sets the window scroll rate and crawl rate.
IRMALiveText::SetType
Determines the window type (generic, tickertape, and so on).
IRMALiveText::SetWindowDimensions
Controls the window width and height in pixels.
IRMALiveText::UseWordwrap
Sets word wrap on or off.
After initializing the RealText Broadcast Library, the broadcast application passes text to the library, which then creates the RealSystem packets transmitted by the broadcast plug-in. The broadcast application uses the following IRMALiveText
methods to pass the text:
IRMALiveText::AddData
This method passes the text (char) and includes a Boolean value that, when set to TRUE
, causes the library to broadcast all text in its buffer immediately. If the value is FALSE
, the library holds the data until it either has enough data to make a packet approximately 500 bytes in size, or two seconds has elapsed since the last packet was sent.
The text can include any RealText mark-up. If the text does not include <time begin>
tags, the broadcast library timestamps the text as it is received. So if the broadcast application sends text string B to the library one second after it sends string A, the clients' RealText renderers display string B one second after displaying string A.
IRMALiveText::AddTickerItem
Used only with tickertape windows, this method passes parameters (char) for both the upper ticker value and the lower ticker value. Like IRMALiveText::AddData
, it includes a Boolean value for sending all buffered text immediately. When you use this method, you do not need to enclose the text in <tu>
and <tl>
mark-up tags.
IRMALiveText::flush
Calling this method causes the library to broadcast and clear all data in its buffer. An IRMALiveText::AddData
or IRMALiveText::AddTickerItem
call with the Boolean parameter set to TRUE
also flushes the buffer.
IRMALiveText::GetTime
This method returns the number of milliseconds that have passed since the broadcast application started up.
IRMALiveText::Process
The application calls this method after calling IRMALiveText::AddData
, IRMALiveText::AddTickerItem
, or IRMALiveText::flush
to allow the library to perform necessary processing. When not sending text, the application should also call this method approximately every five seconds. This method is required due to the asynchronous nature of RealSystem.
The IRMALiveText
interface does not have a corresponding response interface that the broadcast application implements to receive feedback from the RealText Broadcast Library. The application can call the following methods, however, to determine the library's status:
IRMALiveText::EncoderIsDone
This method, called after IRMALiveText::SetEncoderDone
, returns a Boolean value that indicates if the library has broadcast all text it has received.
IRMALiveText::EncoderIsInitialized
This method returns a Boolean value indicating that the library has received the initialization parameters that enable it to connect to the RealServer broadcast plug-in. After initialization, the library is ready to receive text.
IRMALiveText::PacketsHaveStarted
The Boolean value returned for this method indicates whether the library has started sending packets to the broadcast plug-in.
IRMALiveText::SetEncoderDone
The broadcast application calls this method to notify the library that it has finished sending text.
Interfaces to the RealText Broadcast Library are defined in rmalvtxt.h
. Sample code for streaming text that uses the library is provided in:
This sample file builds a simple encoder that sends text every 5.5 seconds to a tickertape window. This text contains the time since the encoder started and has a hyperlink to a United States government atomic clock web page to demonstrate how to add hyperlinks to live text.
The more complex main2.cpp streams the entire contents of an input text file every time it detects that the file has been updated (which it does by seeing if the file has been saved since the last check). It also prompts for window type, window size, and window background color.
![]() |
Additional Information |
---|
RealText Authoring Guide, which is available at http://service.real.com/help/library/index.html, explains the RealText window attributes. |
The sample code includes a simple command-line interface for gathering the required initialization parameters. Both main.cpp and main2.cpp contain comments telling you how to modify the applications, including where text is added to the stream. The comments in rmalvtxt.h
tell how to alter the stream's window attributes, such as background color, height, and width.
Carry out the following steps to modify the sample code and implement remote broadcasting for your application:
PATH
(LD_LIBRARY_PATH
for UNIX). These libraries are listed in the table "RealText Broadcast Components".
pLiveTextEncoder-InitLiveText(szHost, atoi(szPort), szUsername, szPassword, szFilename);
IRMALiveText::Process
frequently to allow the library to perform its necessary processing.
LoadLibrary
as shown in main.cpp.
![]() |
Additional Information |
---|
See "Compiling a Plug-In" for general build instructions. |
Do the following to test broadcasting with your application:
FSMount
parameter to specify the broadcast plug-in's mount point, short name, port, and, optionally, password. If the parameter does not specify a password, passwords passed to the broadcast library are ignored and any broadcast application can connect to the plug-in.
![]() |
Additional Information |
---|
See "FSMount Parameter". |
Start the broadcast application, connecting it to the port defined in the plug-in's FSMount
parameter. The following example shows how to do this from the command line for an application connecting to RealServer port 7072 and broadcasting a file named ticker (the syntax may differ for your application):
% exlvtext rmaserver.site.com 7072 <user name
> <password
> ticker
rtsp://serverhost.domain.com/mountpoint/filename
For example, with the ticker broadcast example above, the URL would be:
rtsp://rmaserver.site.com/encoder/ticker
RealPlayer should buffer then play the broadcast. The scrollbar is disabled when RealPlayer receives live content.