3) Authentication
Now that you've learned and (hopefully) configured creating live sessions on your site and learned how to view the live video of these sessions, you can set-up authentication for these viewers. To join a live session, your users can be authenticated by a key, by entering a login name and password, or no authentication at all. Typically, a key type authentication is used when passcode or keys are associated with a live session. For example, let's say a live session on your site is a ticketed event, you can distribute a passcode (or code) to users who purchased a ticket. These users can then enter these passcodes (or codes) as they join the live session. Using the call back URL, StreamAPI notifies you to authenticate (with key=passcode) these users. The login name and password type authentication is used if you want your members to be the only ones to enter or join any live sessions on your site. Again, using the callback URL, StreamAPI passes the entered login name & password to notify you to authenticate these users. You can only use one type of authentication. Either use the key type authentication OR login name & password type authentication, you cannot use both. A step-by-step guide for each of these options below:
- No Authentication Option 1: No Callback URL
- With Key Authentication Type Step 1: Configure Theme Editor
- With UserName/Password Authentication Type Step 1: Configure Theme Editor
- With Auto Login
Option 2: Set-up Callback URL with No Authentication
Sample Embed Code
Step 2: Set-up Callback URL
Step 3: Sample Embed Code
Step 2: Set-up Callback URL
Step 3: Sample Embed Code
No Authentication
You can set-up users to join live sessions without any authentication. Currently, you can do this by either NOT having any call back URL or setting up your call back URL to not do any authentication. By modifying the embed code, you can choose to have users input their display name or use the StreamAPI default name (Guest+RandomNumber = Guest1234) that will be displayed on the user list.
Option 1: No Callback URL
Like mentioned above, you can set-up users to join live sessions without any authentication by not setting up or removing the call back URL in your API Settings page. However, if you remove
this or not set this, NO authentication to your system will ever be done for all the live sessions that you create.
Option 2: Set-up Callback URL with No Authentication
You can control authentication or no authentication through your call back URL. If there are live sessions in your site which do not require any authentication, you can control this logic in your callback code. StreamAPI passes through the public host ID value to your callback URL. You can store in your system which public host ids require authentication or not. Please see code example below:
Sample Code
- Java
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String CONTENT_TYPE = "text/xml; charset=UTF-8";
response.setContentType(CONTENT_TYPE);
PrintWriter out = response.getWriter();
String code = "0";
String INVALID_PASSCODE = "1000";
String action = request.getParameter("action");
String key = request.getParameter("key");
String uname = request.getParameter("username");
String passwdParam = request.getParameter("password");
String passwd = (passwdParam == null || passwdParam.isEmpty()) ? "" : passwdParam;
String hostid = request.getParameter("public_hostid");
UserTransaction tx = TxnService.getTransaction();
try {
tx.begin();
StringWriter writer = new StringWriter();
AttributesImpl emptyAttr = null;
StreamResult streamResult = new StreamResult(writer);
SAXTransformerFactory tf =
(SAXTransformerFactory) SAXTransformerFactory.newInstance();
TransformerHandler th = tf.newTransformerHandler();
Transformer serializer = th.getTransformer();
serializer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
serializer.setOutputProperty(OutputKeys.INDENT, "yes");
th.setResult(streamResult);
th.startDocument();
th.startElement("", "", "response", emptyAttr);
User user = null;
if (action.equals("login")) {
/* Check if the public host id is set to have its session
WITH or WITHOUT Authentication.
Default authentication requirement is set to true
*/
boolean requiresAuth = true;
if (hostid != null && !hostid.isEmpty()) {
requiresAuth =
SessionService.hasAuthRequirement(Long.valueOf(hostid));
}
if (requiresAuth) {
if ( (key != null && !key.isEmpty()) &&
(username == null || username.isEmpty()) ) {
// Key Authentication Type
/* Check if the input key value is valid.
In this method "getUserByKey", you can pass
in the key and the method can check your
database to see if there
is a matching key value. You can then return
a User object that has properties about the
authenticated user such as "display Name".
You can store a mapping of key and
display name in your database, which
this method can query to get the User object.
*/
user = UserService.getUserByKey(key);
}
// Login Name and Password Authentication Type
else {
/* Check if the input combination of
username and password is valid in
your system.
In this method "getUserByNameAndPassword",
you can pass in the username and password
and the method can check your database
to see if there
is a matching combination of these 2 values.
You can then return a User
object that has properties about
the authenticated
user such as "display Name".
*/
user = UserService.getUserByNameAndPassword(uname, passwd);
}
}
else {
key = (key == null || key.isEmpty()) ? "Guest" : key;
// You can also set the constructor to User(String displayName);
user = new User();
user.setDisplayName(key);
}
if (user == null) {
code = INVALID_PASSCODE;
th.startElement("", "", "code", emptyAttr);
th.characters(code.toCharArray(), 0, code.length());
th.endElement("", "", "code");
String message = "Invalid Passcode";
th.startElement("", "", "message", emptyAttr);
th.characters(message.toCharArray(), 0,
message.length());
th.endElement("", "", "message");
}
else {
String displayName = user.getDisplayName();
th.startElement("", "", "user", emptyAttr);
th.startElement("", "", "name", emptyAttr);
th.characters(displayName.toCharArray(), 0,
displayName.length());
th.endElement("", "", "name");
th.endElement("", "", "user");
th.startElement("", "", "code", emptyAttr);
th.characters(code.toCharArray(), 0, code.length());
th.endElement("", "", "code");
}
th.endElement("", "", "response");
th.endDocument();
output = writer.toString();
tx.commit();
}
catch (Exception e) {
try {
tx.rollback();
} catch (Exception re) {}
throw new ServletException(e);
}
out.print(output);
}
Embed Code for No Authentication
After setting up your callback URL to not have authentication (please see option 1 or option 2 above), you can modify the embed code to allow your users to enter their own name. In the embed code (usually found in the Quick Stream page), you'll need to change the values in flashvars variable - authField2Label=[AnyTextFieldNameThatYouWant] and authType=key Please see sample embed code below.
Make sure the embed code is all in one line
<embed height="538" width="514" wmode="" type="application/x-shockwave-flash" bgcolor="#000000" quality="high" scale="noscale" allowfullscreen="true" allowscriptaccess="always" flashvars= "authField2Label=Display Name: &siteID=1000002560 &layoutPath=/themes/100/000/256/0/theme_e5fe34c4-6598-11de-b33b-892b27c38468.xml &skinPath=/themes/100/000/256/0/skin_e5fe34c4-6598-11de-b33b-892b27c38468.xml &publicHostID=1000014541 &authField1Label=UserName: &authType=key &userType=204&" src="http://static.streamapi.com/flash/loader.swf?app=custom.swf" /> />
With Key Authentication Type
Step 1: Configure Theme Editor
For both types of authentication (key or login name/password), the first step is to configure the theme editor. To do this, open the theme editor and select the theme that will have the authentication by key. You can do this by clicking on "Theme Editor" and clicking on the appropriate theme in the list on the left hand side.
The theme editor will open for this theme. Once it's loaded and ready for you to edit, click on the "Login" button or the "loginButton" Component. Under "Button Behavior", select "Call built-in function" in the drop down.
Then make sure that "loginButton" is selected under the "Built-in Function" drop down box. Save the theme by going to "Theme Menu" and click on "Save Theme".
Step 2: Set-up Callback URL
Your callback URL is used by StreamAPI to notify you of events and actions. In this case, the callback URL that you're about to set-up will be used by StreamAPI to authenticate your users. The callback URL lives in your server and is defined in your API Settings page.
Callback Request with Key Authentication
Typically, it's something like http://yoursite.com/streamapi/callback, but any URL we can reach is fine
POST http://yoursite.com/streamapi/callback
action => login
key => letmein
public_hostid => 123456
userip= > 127.0.0.1
Required Parameters
- action Event that StreamAPI notifies you with. For authentication callbacks, the value for the action parameter is login action=login for all authentication
- key Passcode key for the live session. [a-zA-Z0-9] alphanumeric characters only, no spaces or special characters
Callback Response for Key Authentication
StreamAPI expects an XML format type response from ALL callback URLs.
<?xml version="1.0" encoding="UTF-8" ?>
<response>
<user>
<name>MyCoolName</name>
<role>cohost</role>
</user>
<code>0</code>
</response>
Required XML Response
- Successful Authentication code = Response result of the callback URL. For successful authentication, code = 0
<?xml version="1.0" encoding="UTF-8" ?>
<response>
<code>0</code>
</response>
message = Response message that you want to be displayed on the live session player. For example, if a user has put in an incorrect key, you can return message = Invalid Passcode
<?xml version="1.0" encoding="UTF-8" ?>
<response>
<code>1000</code>
<message>Invalid Passcode</message>
</response>
Optional XML Response (only for successful authentication)
- name Name of the user to be displayed on the user list of the live session player. If there's no value returned for name, "Guest[randomnumber]" will be displayed on the screen.
<?xml version="1.0" encoding="UTF-8" ?>
<response>
<user>
<name>MyCoolName</name>
</user>
<code>0</code>
</response>
Sample Code
- Java
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String CONTENT_TYPE = "text/xml; charset=UTF-8";
response.setContentType(CONTENT_TYPE);
PrintWriter out = response.getWriter();
String code = "0";
String INVALID_PASSCODE = "1000";
String action = request.getParameter("action");
String key = request.getParameter("key");
String uname = request.getParameter("username");
String passwdParam = request.getParameter("password");
String passwd = (passwdParam == null || passwdParam.isEmpty()) ? "" : passwdParam;
String hostid = request.getParameter("public_hostid");
UserTransaction tx = TxnService.getTransaction();
try {
tx.begin();
StringWriter writer = new StringWriter();
AttributesImpl emptyAttr = null;
StreamResult streamResult = new StreamResult(writer);
SAXTransformerFactory tf =
(SAXTransformerFactory) SAXTransformerFactory.newInstance();
TransformerHandler th = tf.newTransformerHandler();
Transformer serializer = th.getTransformer();
serializer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
serializer.setOutputProperty(OutputKeys.INDENT, "yes");
th.setResult(streamResult);
th.startDocument();
th.startElement("", "", "response", emptyAttr);
User user = null;
if (action.equals("login")) {
// Key Authentication Type
if ( (key != null && !key.isEmpty()) &&
(username == null || username.isEmpty()) ) {
/* Check if the input key value is valid.
In this method "getUserByKey", you can pass in the key
and the method can check your database to see if there
is a matching key value. You can then return a User
object that has properties about the authenticated
user such as "display Name". You can store a mapping
of key and display name in your database, which
this method can query to get the User object.
*/
user = UserService.getUserByKey(key);
}
// Login Name and Password Authentication Type
else {
/* Check if the input combination of username and password
is valid in your system.
In this method "getUserByNameAndPassword",
you can pass in the username and password
and the method can check your database to see if there
is a matching combination of these 2 values.
You can then return a User
object that has properties about the authenticated
user such as "display Name".
*/
user = UserService.getUserByNameAndPassword(uname, passwd);
}
if (user == null) {
code = INVALID_PASSCODE;
th.startElement("", "", "code", emptyAttr);
th.characters(code.toCharArray(), 0, code.length());
th.endElement("", "", "code");
String message = "Invalid Passcode";
th.startElement("", "", "message", emptyAttr);
th.characters(message.toCharArray(), 0,
message.length());
th.endElement("", "", "message");
}
else {
String displayName = user.getDisplayName();
th.startElement("", "", "user", emptyAttr);
th.startElement("", "", "name", emptyAttr);
th.characters(displayName.toCharArray(), 0,
displayName.length());
th.endElement("", "", "name");
th.endElement("", "", "user");
th.startElement("", "", "code", emptyAttr);
th.characters(code.toCharArray(), 0, code.length());
th.endElement("", "", "code");
}
th.endElement("", "", "response");
th.endDocument();
output = writer.toString();
tx.commit();
}
catch (Exception e) {
try {
tx.rollback();
} catch (Exception re) {}
throw new ServletException(e);
}
out.print(output);
}
< ?php
$action = $_POST['action'];
$public_hostid = $_POST['public_hostid'];
$siteid = $_POST['siteid'];
$sessionid = $_POST['sessionid'];
$user_ip = $_POST['userip'];
$numtry = $_POST['numtry'];
$key = $_POST['key'];
// user map - this is for static user login/password combinations - you will need to change this to use a database for authentication
// 'kramer' => array( 'password' => 'test10' , 'role' =>'guest' )
$user_map = array(
'guestsecretkey' => array( 'name' => 'jerry', 'role' =>'guest' ),
'membersecretkey' => array( 'name' => 'dwight','role' =>'cam1' )
);
$user_object = $user_map[$key];
if (isset($user_object)) == 0) {
echo('<?xml version="1.0" encoding="UTF-8" ?><response><user><name>' . $$user_object['name'] . '</name><role>' . $user_object['role'] . '</role></user><code>0</code></response>');
} else {
echo ('<?xml version="1.0" encoding="UTF-8" ?><response><code>8</code><message>authentication failed</message></respons>');
}
?>
Set Callback URL
Like mentioned earlier, the callback URL is defined in your API Settings page. Once you've written, tested, and released your callback URL for key authentication,
set the callback URL for your site in the API Settings page.
Step 3: Sample Embed Code for Key Authentication Type
Make sure the embed code is all in one line
<embed height="538" width="514" wmode="" type="application/x-shockwave-flash" bgcolor="#000000" quality="high" scale="noscale" allowfullscreen="true" allowscriptaccess="always" flashvars= "authField2Label=Passcode Key: &siteID=1000002560 &layoutPath=/themes/100/000/256/0/theme_e5fe34c4-6598-11de-b33b-892b27c38468.xml &skinPath=/themes/100/000/256/0/skin_e5fe34c4-6598-11de-b33b-892b27c38468.xml &publicHostID=1000014541 &authType=key &userType=204&" src="http://static.streamapi.com/flash/loader.swf?app=custom.swf" /> />
Java Script style embed code
<div id="player_container"></div>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/swfobject/2.1/swfobject.js"></script>
<script type="text/javascript">
swfobject.embedSWF("http://static.streamapi.com/flash/loader.swf", "player_container",
"538", "514", "9", "", {
'app' : 'custom.swf',
'authField2Label' : 'Passcode Key:',
'siteID' : '1000002560',
'publicHostID' : '1000014541',
'layoutPath' : '/themes/100/000/256/0/theme_e5fe34c4-6598-11de-b33b-892b27c38468.xml',
'skinPath' : 'themes/100/000/256/0/skin_e5fe34c4-6598-11de-b33b-892b27c38468.xml',
'authType' : 'key',
'userType' : '204'
}, {
allowfullscreen: "true",
allowscriptaccess: "true"
});
</script type="text/javascript">
Anatomy of the embed code
height
height dimension of the flash player
width
width dimension of the flash player
flashvars
- authField2Label Value is REQUIRED for key type authentication. The value for this field will be the label or text that will be displayed when your user clicks on the "Login" button. If there's no value specified, the default is "Password".
- siteID Your StreamAPI site ID that can be found in your API Settings page
- layoutPath Theme layout path. You can find this value in the theme editor under "Embed Info" and "layoutPath"
- skinPath Theme skin path. You can find this value in the theme editor under "Embed Info" and "skinPath"
- publicHostID public host ID of the broadcaster. This is the publicHostID response from create user session API
- authType Value for this field is key, if it is a key type authentication
- userType 204
NOTE: authField1Label is NOT required for key type authentication. You can still add it as one of the parameters inside flashvars if you want to have your users enter other information besides the key. For example, authField1Label value can be "Display Name", which would be the named displayed on the flash player.
src
URL of the flash swf file
http://static.streamapi.com/flash/loader.swf?app=custom.swf
With UserName/Password AuthenticationType
Step 1: Configure Theme Editor
For both types of authentication (key or login name/password), the first step is to configure the theme editor. To do this, open the theme editor and select the theme that will have the authentication by key. You can do this by clicking on "Theme Editor" and clicking on the appropriate theme in the list on the left hand side.
The theme editor will open for this theme. Once it's loaded and ready for you to edit, click on the "Login" button or the "loginButton" Component. Under "Button Behavior", select "Call built-in function" in the drop down.
Then make sure that "loginButton" is selected under the "Built-in Function" drop down box. Save the theme by going to "Theme Menu" and click on "Save Theme".
Step 2: Set-up Callback URL
Callback Request with Login Name and Password Authentication
Typically, it's something like http://yoursite.com/streamapi/callback, but any URL we can reach is fine
POST http://yoursite.com/streamapi/callback
action => login
username => dwight
password => rules
public_hostid => 1234567
userip= > 127.0.0.1
Required Parameters
- action Event that StreamAPI notifies you with. For authentication callbacks, the value for the action parameter is login action=login for all authentication
- username Login name of the user being authenticated. The value can be a user name or email depending on what is stored in your system as the login name for your members. [a-zA-Z0-9] alphanumeric characters only, no spaces or special characters
- password Password of the user being authenticated. StreamAPI will pass the combination of username and password to your call back url, which will then check to make sure that the combination of username and password matches with record in your system. [a-zA-Z0-9] alphanumeric characters only, no spaces.
Callback Response
StreamAPI expects an XML format type response from ALL callback URLs.
<?xml version="1.0" encoding="UTF-8" ?>
<response>
<user>
<name>MyCoolName</name>
<role>cohost</role>
</user>
<code>0</code>
</response>
Required XML Response
- Successful Authentication code = Response result of the callback URL. For successful authentication, code = 0
<?xml version="1.0" encoding="UTF-8" ?>
<response>
<code>0</code>
</response>
message = Response message that you want to be displayed on the live session player. For example, if a user has put in an incorrect key, you can return message = Invalid Passcode
<?xml version="1.0" encoding="UTF-8" ?>
<response>
<code>1000</code>
<message>Invalid Passcode</message>
</response>
Optional XML Response (only for successful authentication)
- name Name of the user to be displayed on the user list of the live session player. If there's no value returned for name, "Guest[randomnumber]" will be displayed on the screen.
<?xml version="1.0" encoding="UTF-8" ?>
<response>
<user>
<name>MyCoolName</name>
</user>
<code>0</code>
</response>
Sample Code
- Java
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String CONTENT_TYPE = "text/xml; charset=UTF-8";
response.setContentType(CONTENT_TYPE);
PrintWriter out = response.getWriter();
String code = "0";
String INVALID_PASSCODE = "1000";
String action = request.getParameter("action");
String key = request.getParameter("key");
String uname = request.getParameter("username");
String passwdParam = request.getParameter("password");
String passwd = (passwdParam == null || passwdParam.isEmpty()) ? "" : passwdParam;
String hostid = request.getParameter("public_hostid");
UserTransaction tx = TxnService.getTransaction();
try {
tx.begin();
StringWriter writer = new StringWriter();
AttributesImpl emptyAttr = null;
StreamResult streamResult = new StreamResult(writer);
SAXTransformerFactory tf =
(SAXTransformerFactory) SAXTransformerFactory.newInstance();
TransformerHandler th = tf.newTransformerHandler();
Transformer serializer = th.getTransformer();
serializer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
serializer.setOutputProperty(OutputKeys.INDENT, "yes");
th.setResult(streamResult);
th.startDocument();
th.startElement("", "", "response", emptyAttr);
User user = null;
if (action.equals("login")) {
// Key Authentication Type
if ( (key != null && !key.isEmpty()) &&
(username == null || username.isEmpty()) ) {
/* Check if the input key value is valid.
In this method "getUserByKey", you can pass in the key
and the method can check your database to see if there
is a matching key value. You can then return a User
object that has properties about the authenticated
user such as "display Name". You can store a mapping
of key and display name in your database, which
this method can query to get the User object.
*/
user = UserService.getUserByKey(key);
}
// Login Name and Password Authentication Type
else {
/* Check if the input combination of username and password
is valid in your system.
In this method "getUserByNameAndPassword",
you can pass in the username and password
and the method can check your database to see if there
is a matching combination of these 2 values.
You can then return a User
object that has properties about the authenticated
user such as "display Name".
*/
user = UserService.getUserByNameAndPassword(uname, passwd);
}
if (user == null) {
code = INVALID_PASSCODE;
th.startElement("", "", "code", emptyAttr);
th.characters(code.toCharArray(), 0, code.length());
th.endElement("", "", "code");
String message = "Invalid Passcode";
th.startElement("", "", "message", emptyAttr);
th.characters(message.toCharArray(), 0,
message.length());
th.endElement("", "", "message");
}
else {
String displayName = user.getDisplayName();
th.startElement("", "", "user", emptyAttr);
th.startElement("", "", "name", emptyAttr);
th.characters(displayName.toCharArray(), 0,
displayName.length());
th.endElement("", "", "name");
th.endElement("", "", "user");
th.startElement("", "", "code", emptyAttr);
th.characters(code.toCharArray(), 0, code.length());
th.endElement("", "", "code");
}
th.endElement("", "", "response");
th.endDocument();
output = writer.toString();
tx.commit();
}
catch (Exception e) {
try {
tx.rollback();
} catch (Exception re) {}
throw new ServletException(e);
}
out.print(output);
}
< ?php
$action = $_POST['action'];
$username = $_POST['username'];
$password = $_POST['password'];
$public_hostid = $_POST['public_hostid'];
$siteid = $_POST['siteid'];
$sessionid = $_POST['sessionid'];
$user_ip = $_POST['userip'];
$numtry = $_POST['numtry'];
$key = $_POST['key'];
// user map - this is for static user login/password combinations - you will need to change this to use a database for authentication
// 'kramer' => array( 'password' => 'test10' , 'role' =>'guest' )
$user_map = array(
'jerry' => array( 'password' => 'test7' , 'role' =>'guest' ),
'dwight' => array( 'password' => 'test8' , 'role' =>'cam1' ),
'george' => array( 'password' => 'test9' , 'role' =>'cam2' ),
'kramer' => array( 'password' => 'test10' , 'role' =>'cam3' )
);
$user_object = $user_map[$username];
if (isset($user_object) && strcmp($password, $user_object['password']) == 0) {
echo('<?xml version="1.0" encoding="UTF-8" ?><response><user><name>' . $username . '</name><role>' . $user_object['role'] . '</role></user><code>0</code></response>');
} else {
echo ('<?xml version="1.0" encoding="UTF-8" ?><response><code>8</code><message>authentication failed</message></respons>');
}
?>
Set Callback URL
Like mentioned earlier, the callback URL is defined in your API Settings page. Once you've written, tested, and released your callback URL for key authentication,
set the callback URL for your site in the API Settings page.
Step 3: Sample Embed Code for UserName/Password Authentication Type
Make sure the embed code is all in one line
<embed height="538" width="514" mode="" type="application/x-shockwave-flash" bgcolor="#000000" quality="high" scale="noscale" allowfullscreen="true" allowscriptaccess="always" flashvars= "authField1Label=Login Name: &authField2Label=Password: &siteID=1000002560 &layoutPath=/themes/100/000/256/0/theme_e5fe34c4-6598-11de-b33b-892b27c38468.xml &skinPath=/themes/100/000/256/0/skin_e5fe34c4-6598-11de-b33b-892b27c38468.xml &publicHostID=1000014541 &authType=nameAndPass &userType=204&" src="http://static.streamapi.com/flash/loader.swf?app=custom.swf" />
Java Script style embed code
<div id="player_container"></div>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/swfobject/2.1/swfobject.js"></script>
<script type="text/javascript">
swfobject.embedSWF("http://static.streamapi.com/flash/loader.swf", "player_container",
"538", "514", "9", "", {
'app' : 'custom.swf',
'authField1Label' : 'Login Name:',
'authField2Label' : 'Password:',
'siteID' : '1000002560',
'publicHostID' : '1000014541',
'layoutPath' : '/themes/100/000/256/0/theme_e5fe34c4-6598-11de-b33b-892b27c38468.xml',
'skinPath' : 'themes/100/000/256/0/skin_e5fe34c4-6598-11de-b33b-892b27c38468.xml',
'authType' : 'nameAndPass',
'userType' : '204'
}, {
allowfullscreen: "true",
allowscriptaccess: "true"
});
</script type="text/javascript">
Anatomy of the embed code
height
height dimension of the flash player
width
width dimension of the flash player
flashvars
- authField1Label Unlike the key type authentication, authField1Label is REQUIRED for login name/password authentication type. The value for this field will be the first (or top) label or text that will be displayed when your user clicks on the "Login" button. If there's no value specified, the default is "Login".
- authField2Label Value is REQUIRED for login/password authentication type. The value for this field will be the second (or bottom) label or text that will be displayed when your user clicks on the "Login" button. If there's no value specified, the default is "Password".
- siteID Your StreamAPI site ID that can be found in your API Settings page
- layoutPath Theme layout path. You can find this value in the theme editor under "Embed Info" and "layoutPath"
- skinPath Theme skin path. You can find this value in the theme editor under "Embed Info" and "skinPath"
- publicHostID public host ID of the broadcaster. This is the publicHostID response from create user session API
- authType Value for this field is login, if it is a login name/password type authentication
- userType 204
src
URL of the flash swf file
http://static.streamapi.com/flash/loader.swf?app=custom.swf
With Auto Login
If your users are already logged into your website and you don't want them to have to enter their username and password again in the player. You can set the embed to do auto login by following these steps:
1. Use no authentication option above
2. Modify the embed code by changing the flashvars values:
- Add isAutoLogin=true
- Make sure authType=key
- Add key=[YOUR_USERS_DISPLAY_NAME]
Sample Embed Code: (Make sure the embed code is all in one line)
<embed height="538" width="514" mode="" type="application/x-shockwave-flash" bgcolor="#000000" quality="high" scale="noscale" allowfullscreen="true" allowscriptaccess="always" flashvars= "authField1Label=Login Name: &authField2Label=Password: &siteID=1000002560 &layoutPath=/themes/100/000/256/0/theme_e5fe34c4-6598-11de-b33b-892b27c38468.xml &skinPath=/themes/100/000/256/0/skin_e5fe34c4-6598-11de-b33b-892b27c38468.xml &publicHostID=1000014541 &authType=key &userType=204 &isAutoLogin=true &key=MY_DISPLAY_NAME" src="http://static.streamapi.com/flash/loader.swf?app=custom.swf" />