Playing an Asset

View the generated preview URL for a content asset in Media Streams.

During content playback, a session token is used to authenticate the asset streamer. The Console obtains a session token to view the content for 24 hours.

Note

For better playback performance, use content with supported codecs. If the audio is not supported, the video might play without the audio. The supported video codec is H.264, and the supported audio codecs are AAC and MP3.
  • To access the session token service, you must have the following permissions on the compartment associated with the distribution channel containing the packaging configuration into which the asset was ingested:
    • read stream-distribution-channel
    • read stream-packaging-config
    • read stream-cdn-config
    Users with permissions for the specific channel and configuration can generate URL for asset playback.
    1. Open the navigation menu and click Analytics & AI. Under Media Services, click Media Streams.
    2. On the Distribution Channels list page, select the compartment that contains the distribution channel for where you want to play the assets.
    3. Click the name of the channel from which you want to play the asset.
    4. On the Distribution Channel details page, under Resources, click Playlist Assets.
    5. In the Playlist Assets section, search for the playlist asset that you want to play, and click the asset.
    6. On the Playlist Asset details page, in the Preview URL section, select a packaging.
    7. Specify the session token expiration value between 10 minutes to 24 hours. The preview URL expires after the specified time period.
    8. Click Generate.
      A preview URL is generated for the asset. If the URL generation is successful, the preview URL is displayed.
    9. Click Copy and paste the URL in a supported browser.
      You can view the asset directly in a browser.
      Note

      A token is created for every preview URL request. The token expires after 24 hours. After the token expires, you must generate a new preview URL for asset playback.
  • Playlist generation requires a session token for authentication. Therefore, you must generate a session token before generating a playlist. The session token is valid for 24 hours.

    To generate a token, use the generate-session-token command:

    oci media-services media-stream stream-distribution-channel generate-session-token [OPTIONS]

    Required parameters for the generate-session-token command:

    • --endpoint [text]
    • --packaging-config-id [text]
    • --scopes [text]
    • --asset-ids [text]

    After the session token is generated, generate the playlist to play the asset by using the generate-playlist command:

    oci media-services media-stream stream-distribution-channel generate-playlist [OPTIONS]

    Required parameters for the generate-playlist command:

    • --file [filename]
    • --media-asset-id [text]
    • --stream-packaging-config-id [text]
    • --endpoint [text]
    • --token [text]
    Note

    The --endpoint parameter must point to the domain of the desired distribution channel.

    To get all the commands for stream-distribution-channel:

    oci media-services stream-distribution-channel -h

    To get help for the generate-session-token command:

    oci media-services media-stream stream-distribution-channel generate-session-token -h

    To get help for the generate-playlist command:

    oci media-services media-stream stream-distribution-channel generate-playlist -h

    For a complete list of flags and variable options for CLI commands, see the Command Line Reference.

  • To play an asset, use the GeneratePlaylist and GenerateSessionTokenoperations.