Playing HLS (m3u8 playlist) on Windows Phone 8.1

前端 未结 3 573
余生分开走
余生分开走 2020-12-21 06:51

A friend and I have tried to get the video player on Windows Phone 8.1 to play a m3u8 stream, but we\'ve been unavailable to succeed.

What we\'ve tried:

We\

相关标签:
3条回答
  • 2020-12-21 07:13

    Download the player framework, consume the following DLL's:

    DLL's to consume

    Add the player to your xaml:

    xmlns:mmppf="using:Microsoft.PlayerFramework"
    xmlns:smmedia="using:SM.Media.MediaPlayer"
    
     <mmppf:MediaPlayer IsFullScreenVisible="True" IsFullScreenEnabled="True" IsFullScreen="False"  CurrentStateChanged="mPlayer_CurrentStateChanged" x:Name="mPlayer" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsFastForwardEnabled="False" IsInfoEnabled="False" IsLive="True" IsMoreEnabled="False" IsRewindEnabled="False" IsRightTapEnabled="False" IsScrubbingEnabled="False" IsSeekEnabled="False" IsSkipBackEnabled="False" IsSkipAheadEnabled="False" IsReplayEnabled="False" IsTimelineVisible="False" IsTimeElapsedVisible="False" IsTimeRemainingVisible="False" RequestedTheme="Dark">
                <mmppf:MediaPlayer.Plugins>
                    <smmedia:StreamingMediaPlugin />
                </mmppf:MediaPlayer.Plugins>
    
            </mmppf:MediaPlayer>
    

    Then set your stream VIA code - or XAML if the URL never changes.

    0 讨论(0)
  • 2020-12-21 07:21

    you can add them from xaml or cs. First add reference.

    1. XAML

      xmlns:local="clr-namespace:Microsoft.PlayerFramework;assembly=Microsoft.PlayerFramework"
      xmlns:smmedia="clr-namespace:SM.Media.MediaPlayer;assembly=SM.Media.MediaPlayer.WP8"
      
      
      <local:MediaPlayer Name="player"
                     HorizontalContentAlignment="Stretch"
                     AutoPlay="True"
                     Volume="0.7"
                     Source="http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8"
                     IsPlayPauseVisible="True">
          <local:MediaPlayer.Plugins>
              <smmedia:StreamingMediaPlugin />
          </local:MediaPlayer.Plugins>
      </local:MediaPlayer>
      
    2. XAML & CS

      xmlns:local="clr-namespace:Microsoft.PlayerFramework;assembly=Microsoft.PlayerFramework"
      
      <local:MediaPlayer Name="player"
                     HorizontalContentAlignment="Stretch"
                     AutoPlay="True"
                     Volume="0.7"              
                     IsPlayPauseVisible="True">
      </local:MediaPlayer>
      
      
      SM.Media.MediaPlayer.StreamingMediaPlugin asd = new SM.Media.MediaPlayer.StreamingMediaPlugin();
      player.Plugins.Add(asd);
      player.Source = new Uri("http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8");
      
    0 讨论(0)
  • 2020-12-21 07:30

    @Mahesh Vemuri asked what if he has error that says StreamingMediaPlugin is not available or not found in namespace, here is my work around: XAML:

    xmlns:PlayerFramework="using:Microsoft.PlayerFramework"
    
    
    <PlayerFramework:MediaPlayer Name="player"
                        Source="http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8"
                        AudioCategory="BackgroundCapableMedia"
                        IsAudioSelectionVisible="True">
            <PlayerFramework:MediaPlayer.Plugins>
            </PlayerFramework:MediaPlayer.Plugins>
    </PlayerFramework:MediaPlayer>
    

    And in your .xaml.cs file you simply do this:

    SM.Media.MediaPlayer.StreamingMediaPlugin asd = new SM.Media.MediaPlayer.StreamingMediaPlugin();
    player.Plugins.Add(asd);
    player.Source = new Uri("address-to-m3u8");
    

    It worked for me since "default" way didn't. Hope it helps someone else, too.

    0 讨论(0)
提交回复
热议问题