Hi All
I am creating a public site that enable users to stream videos, I'm not gonna go into the site logic I'll stick to the point. I want to be able to pull videos from a server and play them on my site, I've gone 360 trying to get this, countless tutorials but somehow they don't work
Is there a way to use a player I created using silverlight in my mvc2 c# web application?
or is there a better approach in doing this?
Any Assistance will be appreciated.
MainPage.xaml
<UserControl x:Class="SimplePlayer.MainPage"
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:SSME="clr-namespace:Microsoft.Web.Media.SmoothStreaming;assembly=Microsoft.Web.Media.SmoothStreaming"
mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
<Grid x:Name="LayoutRoot">
<Grid.RowDefinitions>
<RowDefinition Height="0.95*"></RowDefinition>
<RowDefinition Height="0.05*"></RowDefinition>
</Grid.RowDefinitions>
<SSME:SmoothStreamingMediaElement AutoPlay="True" x:Name="SmoothPlayer" SmoothStreamingSource="http://streams.smooth.vertigo.com/elephantsdream/Elephants_Dream_1024-h264-st-aac.ism/manifest" Grid.Row="0" />
<StackPanel Orientation="Horizontal" Grid.Row="1">
<TextBlock x:Name="Volume" VerticalAlignment="Center" Text="Volume" Width="50" />
<Slider x:Name="VolumeBar" Width="60" Value="{Binding Path=Volume, ElementName=SmoothPlayer, Mode=TwoWay}" />
<Button x:Name="PlayButton" Width="50" Click="PlayButton_Click" Loaded="PlayButton_Loaded"/>
<Button x:Name="StopButton" Content="Stop" Width="50" Click="StopButton_Click" />
</StackPanel>
</Grid>
</UserControl>
MainPage.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Web.Media.SmoothStreaming;
namespace SimplePlayer
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
}
private void PlayButton_Loaded(object sender, RoutedEventArgs e)
{
switch (SmoothPlayer.AutoPlay)
{
case false:
PlayButton.Content = "Play";
break;
case true:
PlayButton.Content = "Pause";
break;
}
}
private void PlayButton_Click(object sender, RoutedEventArgs e)
{
switch (SmoothPlayer.CurrentState)
{
case SmoothStreamingMediaElementState.Playing:
SmoothPlayer.Pause();
PlayButton.Content = "Play";
break;
case SmoothStreamingMediaElementState.Stopped:
case SmoothStreamingMediaElementState.Paused:
SmoothPlayer.Play();
PlayButton.Content = "Pause";
break;
}
}
private void StopButton_Click(object sender, RoutedEventArgs e)
{
SmoothPlayer.Stop();
PlayButton.Content = "Play";
}
}
}
Above Is a Silverlight application that I only use to playback video Can I use this in an MVC2 web application?