1
Vote

Controls not visible when relative height/width used

description

Need to make sure if a user doesn't set height/width that the controls still display correctly even if width is wrong.

file attachments

comments

HelenW wrote Apr 29, 2009 at 9:16 PM

Here's a file that illustrates the problem.

wrote Apr 29, 2009 at 9:16 PM

HelenW wrote Apr 29, 2009 at 10:00 PM

BTW, you folks probably already know this, but if you put a break point in VideoPlayer.Content_FullScreenChanged() once the event handler is invoked, your next action will be to kill the browser from the task manager :)

timheuer wrote Apr 29, 2009 at 11:08 PM

HelenW -- just as a workaround remember to set the object or containing html element to the resolution of the video (which in your sample is 320x240). When set it works fine (see sshot-1.png attached to this item)

wrote Apr 29, 2009 at 11:08 PM

HelenW wrote Apr 30, 2009 at 12:20 AM

Thanks for the tip Tim.

For anyone else who wants to deal with this, here is my code for the MediaOpened event handler:

private void Media_MediaOpened(object sender, RoutedEventArgs e)
{
  double vidHeight = (double)MyPlayer.Media.NaturalVideoHeight;
  double vidWidth = (double)MyPlayer.Media.NaturalVideoWidth;

  double playerHeight = MyPlayer.Height;
  double playerWidth = MyPlayer.Width;

  double heightRatio = vidHeight / playerHeight;
  double widthRatio = vidWidth / playerWidth;
  double ratio = heightRatio;
  if (widthRatio > ratio)
    ratio = widthRatio;
  MyPlayer.Media.Width = vidWidth / ratio;
  MyPlayer.Media.Height = vidHeight / ratio;

  MyPlayer.Play();

}

timheuer wrote Apr 30, 2009 at 3:30 AM

Great -- submit that as a patch!

HelenW wrote Apr 30, 2009 at 3:08 PM

OK, I've attached the code from VideoPlayerThemed.VideoPlayer mediaPlayer_MediaOpened event handler. This may need to go futher up the food chain.

Other than that, how do I go about submitting a patch?

wrote Apr 30, 2009 at 3:08 PM

wrote Feb 21, 2013 at 11:31 PM