Powered by MSDN

US - English
NEW! Silverlight 5 is available Learn More

media player RSS

4 replies

Last post Dec 02, 2008 12:50 PM by Hema123

(0)
  • Hema123

    Hema123

    Member

    14 Points

    116 Posts

    media player

    Dec 01, 2008 11:17 AM | LINK

    Hi,

       I want to create a Media player in silverlight, for this i dont want to use any javascript. Can i do this using Blend 2 and Silverlight 2.

    Can anyone guide me with sample code....

  • silverbyte

    silverbyte

    Participant

    1392 Points

    482 Posts

    Re: media player

    Dec 01, 2008 11:19 AM | LINK

    Please click on 'Mark as answer' near my comment if you feel I answered your question.
  • Hema123

    Hema123

    Member

    14 Points

    116 Posts

    Re: media player

    Dec 01, 2008 11:40 AM | LINK

    I dont have any Expresion encoder here. how can i use that...?

  • y_makram

    y_makram

    Contributor

    6952 Points

    1353 Posts

    Re: media player

    Dec 01, 2008 11:52 AM | LINK

     You can eithe download expression media encoder trial from here: http://www.microsoft.com/expression/products/Overview.aspx?key=encoder

    Or use one of the open source media players, example: http://www.codeplex.com/sl2videoplayer

    Thanks
    Yasser Makram
    Independent Consultant
    http://www.silverlightrecipes.com
    _____
    Dont forget to click "Mark as Answer" on the post that helped you.
  • Hema123

    Hema123

    Member

    14 Points

    116 Posts

    Re: media player

    Dec 02, 2008 12:50 PM | LINK

    Hi All,

    • im using slider control for viewing the video progress. my video size is 21sec. when my video starts the progress time shows 00:01 , 00:02 then its jumping to 00:21 and ending the video.
    •  when i click the full screen button it is showing the video full scrn but when i click escape im not able to see the video. when i refresh the page again, then im able to see the video.
    • cant we switch to full screen mode while playing the video....?

    Code in Page.xaml

    <Canvas.Resources>

    <Storyboard x:Name="StoryBoard1" Storyboard.TargetName="dummy">

    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="dummy" Storyboard.TargetProperty="(UIElement.Opacity)" BeginTime="00:00:00">

    <SplineDoubleKeyFrame KeyTime="00:00:01" Value="0"/>

    </DoubleAnimationUsingKeyFrames>

    </Storyboard>

    </Canvas.Resources>

    <Canvas x:Name="dummy" Height="10" Width="10"/>

    <Slider Height="10" Width="366" Canvas.Top="8" Minimum="0" Maximum="200" x:Name="TimeSlider" ValueChanged="TimeSlider_ValueChanged" />

    Page.xaml.cs

    void Page_Loaded(object sender, RoutedEventArgs e){

    host.Content.IsFullScreen = true;

    host.Content.FullScreenChanged += new EventHandler(Content_FullScreenChanged);

    StoryBoard1.Begin();

    StoryBoard1.Completed +=
    new EventHandler(StoryBoard1_Completed);

    }

    void StoryBoard1_Completed(object sender, EventArgs e){

    progress.Text = Player.Position.ToString();

    TimeSlider.Value =
    Convert.ToDouble(this.Player.Position.Seconds);

    StoryBoard1.Begin();

    }

    void Content_FullScreenChanged(object sender, EventArgs e){

    Page pageobj = new Page();

    if (host.Content.IsFullScreen){

    pageobj.Width = Application.Current.Host.Content.ActualWidth;

    pageobj.Height = Application.Current.Host.Content.ActualHeight;

    Player.Width = Application.Current.Host.Content.ActualWidth;

    Player.Height = Application.Current.Host.Content.ActualHeight;

    }

    else{

    pageobj.Width = old_Width;

    pageobj.Height = old_Height;

    Player.Width = old_MediaWidth;

    Player.Height = old_MediaHeight;

    } }

    private void btnFullScrn_Click(object sender, RoutedEventArgs e){

    Application.Current.Host.Content.IsFullScreen = !Application.Current.Host.Content.IsFullScreen;

    }