Concept

<< 点击显示目录 >>

主页  mappView帮助助手 > mapp View帮助信息 > Widgets  > Media  > VideoPlayer  >

Concept

This section includes detailed explanations for the concept of widget "VideoPlayer".

Changing the video path at runtime

To be able to change the video path at runtime, the following must be taken into account:

The "src" path cannot be changed by a binding at runtime.

The video must first be stopped to allow a new source.

A new path can then be set by a variable, and the VideoPlayer must be restarted.

This application can be easily implemented with the following event binding:

<!-- Das Video wird gestoppt, wenn die Variable geändert wurde. -->
<EventBinding>
    <Source xsi:type="opcUa.Event" refId="::AsGlobalPV:Test" event="ValueChanged" />
        <EventHandler>
        <Action>
            <Target xsi:type="widgets.brease.VideoPlayer.Action" contentRefId="Maincontent" widgetRefId="VideoPlayer1" >
            <Method xsi:type="widgets.brease.VideoPlayer.Action.StopVideo"  />
            </Target>
        </Action>
    </EventHandler>
</EventBinding>
<!-- Der neue src-Pfad von der Variable wird gesetzt und das Video wird neu gestartet. -->
<EventBinding>
    <Source xsi:type="widgets.brease.VideoPlayer.Event" contentRefId="Maincontent" widgetRefId="VideoPlayer1" event="VideoPaused" />
        <Operand name="myOperand" datatype="ANY_STRING">
        <ReadTarget xsi:type="opcUa.NodeAction.Read" refId="::AsGlobalPV:Test" >
            <Method xsi:type="opcUa.NodeAction.GetValue" />
        </ReadTarget>
    </Operand>
        <EventHandler>
        <Sequence>
            <Step order="0">
            <Action>
                <Target xsi:type="widgets.brease.VideoPlayer.Action" contentRefId="Maincontent" widgetRefId="VideoPlayer1" >
                <Method xsi:type="widgets.brease.VideoPlayer.Action.SetSrc" value="=myOperand" />
            </Target>
            </Action>
            </Step>
        <Step order="1">
            <Action>
            <Target xsi:type="widgets.brease.VideoPlayer.Action" contentRefId="Maincontent" widgetRefId="VideoPlayer1" >
                <Method xsi:type="widgets.brease.VideoPlayer.Action.StartVideo"  />
            </Target>
            </Action>
        </Step>
        </Sequence>
    </EventHandler>
</EventBinding>