Jump to content

Recommended Posts

Posted

yeah no worries.. How's this?

You should hopefully be able to get/set the property in both its string and numeric forms.

Func _MediaPlayer_GetStretch($iMPIdx, $bAsString = False)
    Local $vStretch
    If $iMPIdx < 1 Or $iMPIdx >= UBound($__g_apPlayers) Then Return False
    _WinRT_SwitchInterface($__g_apMPElements[$iMPIdx], $sIID_IMediaPlayerElement)
    If Not @error Then $vStretch = IMediaPlayerElement_GetStretch($__g_apMPElements[$iMPIdx])
    If @error Then Return SetError(@error, @extended, -1)
    If $bAsString Then $vStretch = _WinRT_GetEnum($mStretch, $vStretch)
    Return $vStretch
EndFunc

Func _MediaPlayer_SetStretch($iMPIdx, $vStretch)
    If $iMPIdx < 1 Or $iMPIdx >= UBound($__g_apPlayers) Then Return False
    _WinRT_SwitchInterface($__g_apMPElements[$iMPIdx], $sIID_IMediaPlayerElement)
    If Not @error Then
        If IsString($vStretch) Then $vStretch = _WinRT_GetEnum($mStretch, $vStretch)
        IMediaPlayerElement_SetStretch($__g_apMPElements[$iMPIdx], $vStretch)
    EndIf
    Return SetError(@error, @extended, @error = $S_OK)
EndFunc

 

;~ Field :                 None =    0 (Microsoft.UI.Xaml.Media.Stretch)
;~ Field :                 Fill =    1 (Microsoft.UI.Xaml.Media.Stretch)
;~ Field :              Uniform =    2 (Microsoft.UI.Xaml.Media.Stretch)
;~ Field :        UniformToFill =    3 (Microsoft.UI.Xaml.Media.Stretch)

_MediaPlayer_SetStretch($hPlayer1, "UniformToFill")
ConsoleWrite("stretch = " & _MediaPlayer_GetStretch($hPlayer1, True) & @CRLF)
Posted
1 hour ago, MattyD said:

You should hopefully be able to get/set the property in both its string and numeric forms.

Thank you so much for this, Matty. Being able to use string is a bonus as well since I may very well make it so that the user can choose which stretch option in the config file.

I haven't had a chance to play around with it much yet since I just got my butt kicked by Au3Stripper for around 2 hours. I finally won that fight! 🤪

Posted
54 minutes ago, argumentum said:

Stretching it would look ugly. I was thinking of proportional by... , any means.

I'm thinking UniformToFill might be best for times when aspect ratio does not match. I can actually do some logic where the stretch property depends on the aspect ratio of each monitor in comparison to the video file.

I may still do volume control with hot keys or something but I'm not even sure if sound makes sense on live wallpapers or not.

Posted
3 hours ago, MattyD said:

You should hopefully be able to get/set the property in both its string and numeric forms.

I got a chance to test the functions now and they work beautifully. It's really interesting getting to change it and see how different videos of other aspect ratios behave. Thanks again.

Posted (edited)

I updated the script in the first post. On a per-monitor basis, I made it so that if the monitor aspect ratio is equal to the aspect ratio for the video, it will use the default Uniform value. If the aspect ratio is not equal, it will set the UniformToFill value. This should deal with the issue of black bars (letterboxing) being added on the top/bottom or sides of the video. It will simply crop some parts of the video and not stretch it.

I also fixed an issue where the screen would be black briefly before the video started playing. I just had to ensure that the video was fully loaded before showing the GUI(s).

@argumentum I know that you are not a fan of moving wallpapers, but if you have a moment, would you be willing to test this latest script?

The reason why I ask is because your ultrawide secondary monitor is a different aspect ratio and therefore a good example to test whether or not UniformToFill is the better option for mismatching aspect ratios between video and monitor. I think that it makes sense but I don't have another monitor that is a different ratio.

EDIT: And I also made sure that the Start button (and Win key) trigger should play the video on any OS language. It was likely only working with English OS before.

Edited by WildByDesign

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...