In this article:
List Tracks in the Asset
Lists the Tracks in the asset
GET https://{{api-endpoint}}/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks?api-version={{api-version}}
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
accountName |
path | True | string | The Media Services account name. |
assetName |
path | True | string | The Asset name. |
resourceGroupName |
path | True | string | The name of the resource group within the Azure subscription. |
subscriptionId |
path | True | string | The unique identifier for a Microsoft Azure subscription. |
trackName |
path | True | string | The Asset Track name. |
api-version |
query | True | string | The version of the API to be used with the client request. |
Request Body
Name | Type | Description |
---|---|---|
properties.track | TrackBase: AudioTrack VideoTrack TextTrack |
Detailed information about a track in the asset. |
Responses
Name | Type | Description |
---|---|---|
200 OK | AssetTrackCollection |
OK Headers Retry-After: integer |
Other Status Codes | ErrorResponse | Detailed error information. |
Examples
Lists all Tracks
Technology | Sample request |
---|---|
HTTP |
GET https://{{api-endpoint}}/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Media/mediaServices/contosomedia/assets/ClimbingMountRainer/tracks?api-version={{api-version}} |
Java |
/** * Samples for Tracks List. */ public final class Main { /* * x-ms-original-file: * specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/asset-tracks- * list-all.json */ /** * Sample code: Lists all Tracks. * * @param manager Entry point to MediaServicesManager. */ public static void listsAllTracks(com.azure.resourcemanager.mediaservices.MediaServicesManager manager) { manager.tracks().list("contosorg", "contosomedia", "ClimbingMountRainer", com.azure.core.util.Context.NONE); } } To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue. |
Python |
from azure.identity import DefaultAzureCredential from azure.mgmt.media import AzureMediaServices """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-media # USAGE python assettrackslistall.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET. For more info about how to get the value, please see: https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal """ def main(): client = AzureMediaServices( credential=DefaultAzureCredential(), subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.tracks.list( resource_group_name="contoso", account_name="contosomedia", asset_name="ClimbingMountRainer", ) for item in response: print(item) # x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/asset-tracks-list-all.json if __name__ == "__main__": main() To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue. |
Go |
package armmediaservices_test import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mediaservices/armmediaservices/v3" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7bf3adfa2d5e5cdbb804eec35279501794f461c/specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/asset-tracks-list-all.json func ExampleTracksClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armmediaservices.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewTracksClient().NewListPager("contoso", "contosomedia", "ClimbingMountRainer", nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } for _, v := range page.Value { // You could use page here. We use blank identifier for just demo purposes. _ = v } // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. // page.AssetTrackCollection = armmediaservices.AssetTrackCollection{ // Value: []*armmediaservices.AssetTrack{ // { // Name: to.Ptr("video"), // Type: to.Ptr("Microsoft.Media/mediaservices/assets/tracks"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso/providers/Microsoft.Media/mediaservices/contosomedia/assets/ClimbingMountRainer/tracks/video"), // Properties: &armmediaservices.AssetTrackProperties{ // ProvisioningState: to.Ptr(armmediaservices.ProvisioningStateSucceeded), // Track: &armmediaservices.VideoTrack{ // ODataType: to.Ptr("#Microsoft.Media.VideoTrack"), // }, // }, // }, // { // Name: to.Ptr("audio"), // Type: to.Ptr("Microsoft.Media/mediaservices/assets/tracks"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso/providers/Microsoft.Media/mediaservices/contosomedia/assets/ClimbingMountRainer/tracks/audio"), // Properties: &armmediaservices.AssetTrackProperties{ // ProvisioningState: to.Ptr(armmediaservices.ProvisioningStateSucceeded), // Track: &armmediaservices.AudioTrack{ // ODataType: to.Ptr("#Microsoft.Media.AudioTrack"), // }, // }, // }, // { // Name: to.Ptr("text1"), // Type: to.Ptr("Microsoft.Media/mediaservices/assets/tracks"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso/providers/Microsoft.Media/mediaservices/contosomedia/assets/ClimbingMountRainer/tracks/text1"), // Properties: &armmediaservices.AssetTrackProperties{ // ProvisioningState: to.Ptr(armmediaservices.ProvisioningStateSucceeded), // Track: &armmediaservices.TextTrack{ // ODataType: to.Ptr("#Microsoft.Media.TextTrack"), // DisplayName: to.Ptr("Auto generated"), // FileName: to.Ptr("auto_generated.ttml"), // LanguageCode: to.Ptr("en-us"), // PlayerVisibility: to.Ptr(armmediaservices.VisibilityVisible), // }, // }, // }, // { // Name: to.Ptr("text2"), // Type: to.Ptr("Microsoft.Media/mediaservices/assets/tracks"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso/providers/Microsoft.Media/mediaservices/contosomedia/assets/ClimbingMountRainer/tracks/text2"), // Properties: &armmediaservices.AssetTrackProperties{ // ProvisioningState: to.Ptr(armmediaservices.ProvisioningStateSucceeded), // Track: &armmediaservices.TextTrack{ // ODataType: to.Ptr("#Microsoft.Media.TextTrack"), // DisplayName: to.Ptr("user uploaded text track"), // FileName: to.Ptr("text2.vtt"), // HlsSettings: &armmediaservices.HlsSettings{ // Default: to.Ptr(true), // Characteristics: to.Ptr("public.accessibility.transcribes-spoken-dialog,public.easy-to-read"), // Forced: to.Ptr(true), // }, // LanguageCode: to.Ptr("en-us"), // PlayerVisibility: to.Ptr(armmediaservices.VisibilityHidden), // }, // }, // }}, // } } } To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue. |
JavaScript |
const { AzureMediaServices } = require("@azure/arm-mediaservices"); const { DefaultAzureCredential } = require("@azure/identity"); /** * This sample demonstrates how to Lists the Tracks in the asset * * @summary Lists the Tracks in the asset * x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/asset-tracks-list-all.json */ async function listsAllTracks() { const subscriptionId = process.env["MEDIASERVICES_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; const resourceGroupName = process.env["MEDIASERVICES_RESOURCE_GROUP"] || "contoso"; const accountName = "contosomedia"; const assetName = "ClimbingMountRainer"; const credential = new DefaultAzureCredential(); const client = new AzureMediaServices(credential, subscriptionId); const resArray = new Array(); for await (let item of client.tracks.list(resourceGroupName, accountName, assetName)) { resArray.push(item); } console.log(resArray); }} To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue. |
.NET |
using System; using System.Threading.Tasks; using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; using Azure.ResourceManager.Media; using Azure.ResourceManager.Media.Models; // Generated from example definition: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/asset-tracks-list-all.json // this example is just showing the usage of "Tracks_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); // authenticate your client ArmClient client = new ArmClient(cred); // this example assumes you already have this MediaAssetResource created on azure // for more information of creating MediaAssetResource, please refer to the document of MediaAssetResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "contoso"; string accountName = "contosomedia"; string assetName = "ClimbingMountRainer"; ResourceIdentifier mediaAssetResourceId = MediaAssetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, assetName); MediaAssetResource mediaAsset = client.GetMediaAssetResource(mediaAssetResourceId); // get the collection of this MediaAssetTrackResource MediaAssetTrackCollection collection = mediaAsset.GetMediaAssetTracks(); // invoke the operation and iterate over the result await foreach (MediaAssetTrackResource item in collection.GetAllAsync()) { // the variable item is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance MediaAssetTrackData resourceData = item.Data; // for demo we just print out the id Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } Console.WriteLine($"Succeeded"); To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue. |
Sample response
Status code: 200
{ "value": [ { "name": "video", "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Media/mediaservices/contosomedia/assets/ClimbingMountRainer/tracks/video", "type": "Microsoft.Media/mediaservices/assets/tracks", "properties": { "track": { "@odata.type": "#Microsoft.Media.VideoTrack" }, "provisioningState": "Succeeded" } }, { "name": "audio", "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Media/mediaservices/contosomedia/assets/ClimbingMountRainer/tracks/audio", "type": "Microsoft.Media/mediaservices/assets/tracks", "properties": { "track": { "@odata.type": "#Microsoft.Media.AudioTrack" }, "provisioningState": "Succeeded" } }, { "name": "text1", "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Media/mediaservices/contosomedia/assets/ClimbingMountRainer/tracks/text1", "type": "Microsoft.Media/mediaservices/assets/tracks", "properties": { "track": { "@odata.type": "#Microsoft.Media.TextTrack", "fileName": "auto_generated.ttml", "displayName": "Auto generated", "languageCode": "en-us", "playerVisibility": "Visible" }, "provisioningState": "Succeeded" } }, { "name": "text2", "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Media/mediaservices/contosomedia/assets/ClimbingMountRainer/tracks/text2", "type": "Microsoft.Media/mediaservices/assets/tracks", "properties": { "track": { "@odata.type": "#Microsoft.Media.TextTrack", "fileName": "text2.vtt", "displayName": "user uploaded text track", "languageCode": "en-us", "playerVisibility": "Hidden", "hlsSettings": { "default": true, "forced": true, "characteristics": "public.accessibility.transcribes-spoken-dialog,public.easy-to-read" } }, "provisioningState": "Succeeded" } } ] }
Definitions
Name | Description |
---|---|
AssetTrack | An Asset Track resource. |
AssetTrackCollection | A collection of AssetTrack items. |
AudioTrack | Represents an audio track in the asset. |
DashSettings | The DASH setting for a track. |
ErrorAdditionalInfo | The resource management error additional info. |
ErrorDetail | The error detail. |
ErrorResponse | Error response. |
HlsSettings | The HLS setting for a track. |
Provisioning State | Provisioning state of the asset track. |
TextTrack | Represents a text track in an asset. A text track is usually used for sparse data related to the audio or video tracks. |
VideoTrack | Represents a video track in the asset. |
Visibility | When PlayerVisibility is set to "Visible", the text track will be present in the DASH manifest or HLS playlist when requested by a client. When the PlayerVisibility is set to "Hidden", the text will not be available to the client. The default value is "Visible". |
AssetTrack
Name | Type | Description |
---|---|---|
id | string |
Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/ |
name | string | The name of the resource. |
properties.provisioningState | Provisioning state of the asset track. | |
properties.track | TrackBase: AudioTrack TextTrack VideoTrack |
Detailed information about a track in the asset. |
type | string | The type of the resource, e.g., "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". |
AssetTrackCollection
A collection of AssetTrack items.
Name | Type | Description |
---|---|---|
value | AssetTrack | A collection of AssetTrack items. |
AudioTrack
Represents an audio track in the asset.
Name | Type | Description |
---|---|---|
@odata.type |
string: #Microsoft. Media.Audio Track |
The discriminator for derived types. |
bitRate | integer | The stream bit rate for the audio track. |
dashSettings | DashSettings | The DASH specific setting for the audio track. |
displayName | string | The display name of the audio track on a video player. In HLS, this maps to the NAME attribute of EXT-X-MEDIA. |
fileName | string | The file name to the source file. This file is located in the storage container of the asset. |
hlsSettings | HlsSettings | The HLS specific setting for the audio track. |
languageCode | string | The RFC5646 language code for the audio track. |
mpeg4TrackId | integer | The MPEG-4 audio track ID for the audio track. |
DashSettings
Name | Type | Description |
---|---|---|
role | string | The role for the DASH setting. |
ErrorAdditionalInfo
The resource management error additional info.
Name | Type | Description |
---|---|---|
info | object | The additional info. |
type | string | The additional info type. |
ErrorDetail
Name | Type | Description |
---|---|---|
additionalInfo | ErrorAdditionalInfo | The error additional info. |
code | string | The error code. |
details | ErrorDetail | The error details. |
message | string | The error message. |
target | string | The error target. |
ErrorResponse
Name | Type | Description |
---|---|---|
error | ErrorDetail | The error object. |
HlsSettings
Name | Type | Description |
---|---|---|
characteristics | string | The characteristics for the HLS setting. |
default | boolean | The default for the HLS setting. |
forced | boolean | The forced for the HLS setting. |
ProvisioningState
Name | Type | Description |
---|---|---|
Failed | string | Provisioning state failed. |
InProgress | string | Provisioning state in progress. |
Succeeded | string | Provisioning state succeeded. |
TextTrack
Represents a text track in an asset. A text track is usually used for sparse data related to the audio or video tracks.
Name | Type | Description |
---|---|---|
@odata.type |
string: #Microsoft. Media.Audio Track |
The discriminator for derived types. |
displayName | string | The display name of the audio track on a video player. In HLS, this maps to the NAME attribute of EXT-X-MEDIA. |
fileName | string | The file name to the source file. This file is located in the storage container of the asset. |
hlsSettings | HlsSettings | The HLS specific setting for the audio track. |
languageCode | string | The RFC5646 language code for the audio track. |
playerVisibility | Visibility | When PlayerVisibility is set to "Visible", the text track will be present in the DASH manifest or HLS playlist when requested by a client. When the PlayerVisibility is set to "Hidden", the text will not be available to the client. The default value is "Visible". |
VideoTrack
Represents a video track in the asset.
Name | Type | Description |
---|---|---|
@odata.type |
string: #Microsoft. Media.Audio Track |
The discriminator for derived types. |
Visibility
When PlayerVisibility is set to "Visible", the text track will be present in the DASH manifest or HLS playlist when requested by a client. When the PlayerVisibility is set to "Hidden", the text will not be available to the client. The default value is "Visible".
Name | Type | Description |
---|---|---|
Hidden | string | The track is hidden to video player. |
Visible | string | The track is visible to video player. |