In this article:
Get a Track
Get the details of a Track in the Asset
GET https://{{api-endpoint}}/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}?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. |
Responses
Name | Type | Description |
---|---|---|
200 OK | AssetTrack |
OK Headers Retry-After: integer |
Other Status Codes | ErrorResponse | Detailed error information. |
Examples
Get a Track by name
Technology | Sample request |
---|---|
HTTP |
GET https://{{api-endpoint}}/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Media/mediaServices/contosomedia/assets/ClimbingMountRainer/tracks/text1?api-version={{api-version}} |
Java |
/** * Samples for Tracks Get. */ public final class Main { /* * x-ms-original-file: * specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/asset-tracks-get * -by-name.json */ /** * Sample code: Get a Track by name. * * @param manager Entry point to MediaServicesManager. */ public static void getATrackByName(com.azure.resourcemanager.mediaservices.MediaServicesManager manager) { manager.tracks().getWithResponse("contosorg", "contosomedia", "ClimbingMountRainer", "text1", 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 assettracksgetbyname.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.get( resource_group_name="contoso", account_name="contosomedia", asset_name="ClimbingMountRainer", track_name="text1", ) print(response) # x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/asset-tracks-get-by-name.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-get-by-name.json func ExampleTracksClient_Get() { 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) } res, err := clientFactory.NewTracksClient().Get(ctx, "contoso", "contosomedia", "ClimbingMountRainer", "text1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. // res.AssetTrack = armmediaservices.AssetTrack{ // 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), // }, // }, // } } 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 Get the details of a Track in the Asset * * @summary Get the details of a Track in the Asset * x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/asset-tracks-get-by-name.json */ async function getATrackByName() { 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 trackName = "text1"; const credential = new DefaultAzureCredential(); const client = new AzureMediaServices(credential, subscriptionId); const result = await client.tracks.get(resourceGroupName, accountName, assetName, trackName); console.log(result); }} 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-get-by-name.json // this example is just showing the usage of "Tracks_Get" 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 MediaAssetTrackResource created on azure // for more information of creating MediaAssetTrackResource, please refer to the document of MediaAssetTrackResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "contoso"; string accountName = "contosomedia"; string assetName = "ClimbingMountRainer"; string trackName = "text1"; ResourceIdentifier mediaAssetTrackResourceId = MediaAssetTrackResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, assetName, trackName); MediaAssetTrackResource mediaAssetTrack = client.GetMediaAssetTrackResource(mediaAssetTrackResourceId); // invoke the operation MediaAssetTrackResource result = await mediaAssetTrack.GetAsync(); // the variable result 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 = result.Data; // for demo we just print out the id Console.WriteLine($"Succeeded on id: {resourceData.Id}"); 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
{ "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" } }
Definitions
Name | Description |
---|---|
AssetTrack | An Asset Track resource. |
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". |
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. |