Configure Live Streams
If users watch live content and then return to the content details page, two buttons appear: "Watch Now" and "Watch from Beginning":
However, with live content, you only want the "Watch Now" button even when users return to the content, because live content can't be rewound to the beginning.
Removing the "Watch from Beginning" button for Live Content
To remove the "Watch from Beginning" button for live content, you have two options:
- Option 1: Remove the Button Through Navigator.json: Use this approach if all the media within a specific recipe configuration is live content, and you don't have any tags within your feed that identify the content as live.
- Option 2: Remove the Button by Matching a Value in the Feed: Use this approach if only some of the content in your feed is live streamed, and your feed has tags that identify the content that is live.
Option 1: Remove the Button Through Navigator.json
- Open the Navigator.json file (in app > assets).
-
Within the
categories
object that contains recipes for your live feed, add arecipeConfig
object with aliveContent
parameter set totrue
. Here's an example that shows some context:{ "categories" : { "dataLoader" : "recipes/LightCastDataLoaderRecipe1.json", "dynamicParser" : "recipes/LightCastCategoriesRecipe.json" }, "contents" : { "dataLoader" : "recipes/LightCastDataLoaderRecipe1.json", "dynamicParser" : "recipes/LightCastContentsRecipe.json" }, "recipeConfig": { "liveContent": true } } ], "graph": { "com.amazon.android.tv.tenfoot.ui.activities.SplashActivity": { "verifyScreenAccess": false, "verifyNetworkConnection": true, "onAction": "CONTENT_SPLASH_SCREEN" }, "com.amazon.android.tv.tenfoot.ui.activities.ContentBrowseActivity": {
Now for this recipe (LightCastAllContentsRecipe
in the above code sample), the "Watch from Beginning" button won’t be shown when users return to the media after previously watching it.
Option 2: Remove the Button by Matching a Value in the Feed
If your media feed includes tags that identify media as live content, you can configure the matchList
parameter to identify these tags when you configure your Contents recipe.
For example, suppose an item in your feed looks like this, with the <live>true</live>
tag:
<item>
<id>1</id>
<title>Nullamtus</title>
<link>http://www.developer.amazon.com/</link>
<pubdate>Wed, 14 Jan 2015 00:36:00 +0000</pubdate>
<description>Sed a sagittis urna, a fermentum ligula. In sagittis sagittis libero, ut tincidunt sapien egestas.</description>
<image>https://raw.githubusercontent.com/amzn/web-app-starter-kit-for-fire-tv/master/src/common/assets/images/l1.jpg</image>
<category>Lifestyle</category>
<url>http://example.com./myvideos/sample.mp4</url>
<live>true</live>
</item>
In your Content recipe, you can now target the live
tag and match it to live
:
{
"cooker": "DynamicParser",
"format": "xml",
"translator":"ContentTranslator",
"model": "com.amazon.android.model.content.Content",
"modelType": "array",
"query": "rss/channel/item",
"matchList": [
"title/#text@mTitle",
"id/#text@mId",
"description/#text@mDescription",
"url/#text@mUrl",
"image/#text@mCardImageUrl",
"image/#text@mBackgroundImageUrl",
"live/#text@live"
]
}
live
rather than mLive
. In this case, it follows the same convention as Amazon Extras rather than other model tags, which usually begin with m
.Now for these content items, the "Watch from Beginning" button won't be shown when users return to the media after previously watching it.
For more details on using the matchList
parameter, see Configure the Content Recipe.