Xbox 360 Development

This guide is provided to assist an integrator with the use of the Uplynk Xbox 360 SDK. The Xbox 360 SDK provided by Uplynk comes with three plugins. UplynkPlugins.HLS, UplynkPlugins.Captions and UplynkPlugins.Thumbnails. These plugins are loaded automatically when placed in the bin of your application.

Downloads

Please contact Uplynk support for the link to download the latest version of this library.

UplynkPlugins.HLS

The UplynkPlugins.HLS plugin provides playback support for HLS content for your app. Adding the UplynkPlugins.HLS.HLSPlayer control to your xaml page is required.

UplynkPlugins.HLS.HLSPlayer API:

Event Description

AdMarkersAdded

Occurs when all the ad markers, if any, have been added to the AdMarkers collection.

AssetInfoChanged

Occurs when the player starts playing a new asset.

AudioTracksLoaded

Occurs when the asset's audio tracks, if any, have been loaded. An audio track can now be set using the SelectedAudioTrack property. The default audio track is already selected.

SubtitleTrackLoaded

Occurs when the SelectedSubtitleTrack has been loaded and the track slices have begun downloading.

SubtitleTracksLoaded

Occurs when the asset's subtitle tracks, if any, have been loaded. A subtitle track can now be set using the SelectedSubtitleTrack property.

 

Property Description

AvailableAudioTracks

Gets the list of available audio tracks.

AvailableBandwidths

Gets the list of available track bandwidths in bytes per second.

AvailableResolutions

Gets the list of available video resolutions.

AvailableSubtitleTracks

Gets the list of available subtitle tracks.

SelectedAudioTrack

Gets or sets the selected audio track.

SelectedSubtitleTrack

Gets or sets the selected subtitle track. Set to null to unselect the current selected subtitle track.

Basic Playback

Basic playback using the UplynkPlugins.HLS plugin and the HLSPlayer class.

XAML sample code:

<xbox:XboxApplicationPage
      x:Class="SamplePlayerApplication.Player"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:xbox="clr-namespace:Microsoft.Xbox.Controls;assembly=Microsoft.Xbox"
      xmlns:uplynk="clr-namespace:UplynkPlugins.HLS;assembly=UplynkPlugins.HLS"
      xmlns:meta="clr-namespace:Microsoft.SilverlightMediaFramework.Utilities.Metadata;assembly=MMPPF.Utilities.Xbox"
      mc:Ignorable="d"
      d:DesignHeight="720" d:DesignWidth="1280">
      <Grid>
          <uplynk:HLSPlayer x:Name="UplynkPlayer"/>
      </Grid>
</xbox:XboxApplicationPage>

C# sample code:

namespace SamplePlayerApplication
{
    public partial class Player
    {
        public Player()
        {
            InitializeComponent();

            UplynkPlayer.MediaEnded += UplynkPlayer_MediaEnded;
        }

        private void UplynkPlayer_MediaEnded(object sender, EventArgs e)
        {
            UplynkPlayer.Stop();
        }

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            string source = NavigationContext.QueryString["source"];

            var playlistItem = new PlaylistItem { MediaSource = new Uri(source),
                                                  DeliveryMethod = DeliveryMethods.AdaptiveStreaming,
                                                  MediaType = "application/x-mpegURL",
                                                  MediaAssetId = "someId" };

            UplynkPlayer.Playlist.Add(playlistItem);
            UplynkPlayer.Play();
        }
    }
}

Closed Captions

Captions can be enabled by adding the UplynkPlugins.Captions plugin to the output directory of your application. The Captions plugin has several settings that can be set on the UplynkPlayer Xaml declaration. For more information on these settings, please see the Xbox 360 MMPPF Addons documentation.

UplynkPlugins.Captions Setting Description

Uplynk.Captions.Enable708Captioning

Boolean value indicating if 708 caption support is enabled.

Uplynk.Captions.EnableWebVTTCaptioning

Boolean value indicating if WebVTT caption support is enabled.

Enabling captions Xaml sample code:

<xbox:XboxApplicationPage
      x:Class="SamplePlayerApplication.Player"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:xbox="clr-namespace:Microsoft.Xbox.Controls;assembly=Microsoft.Xbox"
      xmlns:uplynk="clr-namespace:UplynkPlugins.HLS;assembly=UplynkPlugins.HLS"
      xmlns:meta="clr-namespace:Microsoft.SilverlightMediaFramework.Utilities.Metadata;assembly=MMPPF.Utilities.Xbox"
      mc:Ignorable="d"
      d:DesignHeight="720" d:DesignWidth="1280">
      <Grid>
          <uplynk:HLSPlayer x:Name="UplynkPlayer">
              <uplynk:HLSPlayer.GlobalConfigMetadata>
                  <meta:MetadataItem Key="Uplynk.Captions.Enable708Captioning" Value="false"/>
                  <meta:MetadataItem Key="Uplynk.Captions.EnableWebVTTCaptioning" Value="true"/>
              </uplynk:HLSPlayer.GlobalConfigMetadata>
          <uplynk:HLSPlayer/>
      </Grid>
</xbox:XboxApplicationPage>

Thumbnails

Thumbnails can be enabled by adding the UplynkPlugins.Thumbnails plugin to the output directory of your application. The Thumbnails plugin has several settings that can be set on the UplynkPlayer Xaml declaration.

UplynkPlugins.Thumbnails Setting Description

Uplynk.Thumbnails.MaxCacheSize

Integer value indicating the maximum number of thumbnails that will be cached. Default value is 30.

Uplynk.Thumbnails.MaxSimultaneousRequests

Integer value indicating the maximum number of simultaneous requests that can occur. Default value is 2.

Uplynk.Thumbnails.PermanentCacheSize

Integer value indicationg the total number of thumbnails that will be cached permanently. Default value is 10.

Uplynk.Thumbnails.PredictionInterval

Integer value, in milliseconds, indicating the minimum amount of time passed before a new prediction will occur. Default value is 250.

Uplynk.Thumbnails.ThumbnailRequestDelay

Integer value, in milliseconds, indicating the delay between subsequent thumbnail requests. Default value is 50.

Setting thumbnails settings Xaml sample code:

<xbox:XboxApplicationPage
      x:Class="SamplePlayerApplication.Player"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:xbox="clr-namespace:Microsoft.Xbox.Controls;assembly=Microsoft.Xbox"
      xmlns:uplynk="clr-namespace:UplynkPlugins.HLS;assembly=UplynkPlugins.HLS"
      xmlns:meta="clr-namespace:Microsoft.SilverlightMediaFramework.Utilities.Metadata;assembly=MMPPF.Utilities.Xbox"
      mc:Ignorable="d"
      d:DesignHeight="720" d:DesignWidth="1280">
      <Grid>
          <uplynk:HLSPlayer x:Name="UplynkPlayer">
              <uplynk:HLSPlayer.GlobalConfigMetadata>
                  <meta:MetadataItem Key="Uplynk.Thumbnails.MaxSimultaneousRequests" Value="1"/>
              </uplynk:HLSPlayer.GlobalConfigMetadata>
          <uplynk:HLSPlayer/>
      </Grid>
</xbox:XboxApplicationPage>