开发者控制台
感谢您的访问。此页面目前仅提供英语版本。我们正在开发中文版本。谢谢您的理解。

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:

  1. Open the Navigator.json file (in app > assets).
  2. Within the categories object that contains recipes for your live feed, add a recipeConfig object with a liveContent parameter set to true. 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"
  ]
}

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.