none
Zoom functionality in media player element: Linking derived media transport controls and media player element RRS feed

  • Question

  • I want to add zoom functionality for media player element(UWP C#) . I placed MediaPlayerElement inside a scroll viewer and zoom functionality is working. But inbuilt media transport transport controls is also getting zoomed and scrolled.
    To avoid this I created a derived transport control as described in https://docs.microsoft.com/en-us/windows/uwp/design/controls-and-patterns/custom-transport-controls#create-a-derived-control
    I assume instead of using inbuilt transport controls and instead use the derived transport control(added outside the scroll viewer)  I can have a zoom feature for media player element.
    <Grid>
        <ScrollViewer HorizontalScrollBarVisibility="Hidden"
                      VerticalScrollBarVisibility="Hidden"
                      MinZoomFactor="1" 
                      ZoomMode="Enabled">
            <MediaPlayerElement Stretch="Uniform"
                                AreTransportControlsEnabled="False"
                                />
        </ScrollViewer>
        <DerivedTransportControls VerticalAlignment="Bottom"
                             HorizontalAlignment="Stretch"
                             />
    </Grid>

    How do I link the DerivedTransportControls with the media player element(so that if I press pause button in my derived control, it automatically pauses the media player.Similar to how the inbuilt controls work)
    I tried linked derived media transport controls with media player element as below.
    mpe.TransportControls = derivedmtc;  
    The above causes an exception: System.ArgumentException: 'Value does not fall within the expected range.' Am I missing something?
    Is it possible to link derived media transport controls with a media player element. Otherwise it seems I have to implement my own custom transport controls and all the features(like auto hide, seek bar etc)
    Sunday, January 5, 2020 8:58 PM

All replies

  • Hi,
    Thanks for posting here.
    UWP questions are not included in the support scope of this Windows desktop development forum. We suggest you go to the following forums to ask:

    https://docs.microsoft.com/answers/index.html

    Best Regards,
    Drake


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, January 6, 2020 1:40 AM