Windows Phoneでスムーズストリーミングするサンプル

2011.08.18

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

Windows Phoneでスムーズストリーミングする簡単なサンプルを作ってみました。
まずは必要なライブラリを以下からダウンロードして下さい。

・Smooth Streaming Client 1.5
SilverlightやWindows PhoneでSmooth Streamingするためのライブラリです。

http://www.iis.net/download/SmoothClient

インストール後、
C:\Program Files (x86)\Microsoft SDKs\IIS Smooth Streaming Client\v1.5\Windows Phoneにある
Microsoft.Web.Media.SmoothStreaming.dllを参照に追加します。

・MMP Player Framework 2.5
動画プレイヤーのフレームワークです。

http://smf.codeplex.com/releases/view/63434

上記のサイトのOther Available Downloadsのところにある
microsoft-smf-binwp7-2.2011.0410.1.zip
というファイルをダウンロードします。

解凍したフォルダ内にある以下のDLLファイルを参照に追加します。
Microsoft.SilverlightMediaFramework.Core.Phone.dll
Microsoft.SilverlightMediaFramework.Plugins.Phone.dll
Microsoft.SilverlightMediaFramework.Plugins.SmoothStreaming.Phone.dll
Microsoft.SilverlightMediaFramework.Utilities.Phone.dll

以下がソースになります。

<phone:PhoneApplicationPage 
    x:Class="SampleSmoothStreaming.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d" d:DesignWidth="728" d:DesignHeight="480"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Landscape" Orientation="Landscape"
    shell:SystemTray.IsVisible="True"
    xmlns:c="clr-namespace:Microsoft.SilverlightMediaFramework.Core;assembly=Microsoft.SilverlightMediaFramework.Core.Phone" 
    xmlns:m="clr-namespace:Microsoft.SilverlightMediaFramework.Core.Media;assembly=Microsoft.SilverlightMediaFramework.Core.Phone">
    
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <c:SMFPlayer>
            <c:SMFPlayer.Playlist>
                <m:PlaylistItem DeliveryMethod="AdaptiveStreaming"
                    MediaSource="http://ecn.channel9.msdn.com/o9/content/smf/smoothcontent/bbbwp7/big buck bunny.ism/manifest"/>
            </c:SMFPlayer.Playlist>
        </c:SMFPlayer>
    </Grid>
</phone:PhoneApplicationPage>


エミュレーター上でも問題なく実行できました。