<Window x:Class="DrawingIn3D.VideoIn3D"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="VideoIn3D" Height="354.4" Width="425.6"
    >
  
  <Grid>


    <Border BorderBrush="Yellow" BorderThickness="1" Margin="5">
      <Viewport3D>
        <Viewport3D.Camera>
          <PerspectiveCamera
          FarPlaneDistance="100"
          LookDirection="2,-1,-1"
          UpDirection="0,1,0"
          NearPlaneDistance="1"
          Position="-20,15,15"
          FieldOfView="60"
            >

          </PerspectiveCamera>
        </Viewport3D.Camera>
        <ModelVisual3D>
          <ModelVisual3D.Content>
            <AmbientLight Color="#555555"></AmbientLight>
          </ModelVisual3D.Content>
        </ModelVisual3D>

        <ModelVisual3D>
          <ModelVisual3D.Content>
            <DirectionalLight
             Color="White"
             Direction="2,3,1" />
          </ModelVisual3D.Content>

        </ModelVisual3D>

        <ModelVisual3D>
          <ModelVisual3D.Content>
            <GeometryModel3D x:Name="cubeGeometry">
              <GeometryModel3D.Geometry>
                <MeshGeometry3D
                  Positions="0,0,0 10,0,0 0,10,0 10,10,0
                             0,0,0 0,0,10 0,10,0 0,10,10
                             0,0,0 10,0,0 0,0,10 10,0,10
                             10,0,0 10,10,10 10,0,10 10,10,0
                             0,0,10 10,0,10 0,10,10 10,10,10
                             0,10,0 0,10,10 10,10,0 10,10,10"
                 TriangleIndices="0,2,1 1,2,3
                                   4,5,6 6,5,7                                   
                                   8,9,10 9,11,10                                   
                                   12,13,14 12,15,13
                                   16,17,18 19,18,17
                                   20,21,22 22,21,23"
                                    TextureCoordinates="0,0 0,1 1,0 1,1
                             1,1 0,1 1,0 0,0                             
                  
                  0,0 0,0 0,0 0,0
                  0,1 1,0 1,1 0,0                             
                             0,0 0,1 1,0 1,1
                             1,1 0,1 1,0 0,0"
                            
                                />

              </GeometryModel3D.Geometry>
              <GeometryModel3D.Material>
                <DiffuseMaterial>
                  <DiffuseMaterial.Brush>
                    <VisualBrush>
                      <VisualBrush.Visual>
                        <MediaElement>
                          <MediaElement.Triggers>
                            <EventTrigger RoutedEvent="MediaElement.Loaded">
                              <EventTrigger.Actions>
                                <BeginStoryboard>
                                  <Storyboard >
                                    <MediaTimeline Source="test.mpg"  />
                                    <DoubleAnimation Storyboard.TargetName="rotate"
                                                     Storyboard.TargetProperty="Angle"
                                                     To="360" Duration="0:0:5" RepeatBehavior="Forever"
                                                     ></DoubleAnimation>

                                  </Storyboard>
                                </BeginStoryboard>
                              </EventTrigger.Actions>
                            </EventTrigger>
                          </MediaElement.Triggers>

                        </MediaElement>
                      </VisualBrush.Visual>
                    </VisualBrush>
                  </DiffuseMaterial.Brush>
                </DiffuseMaterial>
              </GeometryModel3D.Material>
            </GeometryModel3D>
          </ModelVisual3D.Content>
          <ModelVisual3D.Transform>
            <RotateTransform3D>
              <RotateTransform3D.Rotation>
                <AxisAngleRotation3D x:Name="rotate" 
                                     Axis="0 1 0" />
              </RotateTransform3D.Rotation>
            </RotateTransform3D>
          </ModelVisual3D.Transform>
        </ModelVisual3D>


      </Viewport3D>
    </Border>



  </Grid>
</Window>
