+1

How do you dynamically change a video that is playing using the action tag?

kevinbridges 7 years ago updated by icahill (Administrator) 7 years ago 3
I've got an app that checks weather conditions (using Yahoo weather RSS feed) for a user entered zip code (or WOEID). Everything works great, but when I send a new video file request to the tag in my code, it just keeps playing the original video that I sen it. Do I have to do anything special to stop or unload the old video before the new one will play?

Here's the and sample code:

... (first time through, I play this video, and it appears just fine)

... (second time through, I try to play this video, but the original just keeps playing)
Can you wrap your examples in a < code > block so I can see them?
Sorry about that:


<panel name="VideoPanel" width="100%" height="100%">
<panel name="cond-video-panel" width="100%" height="90%" ypos="10%">
<video name="window" tofront="yes" alias="VID-FRAME" width="100%" height="100%" controls="no"></video>
</panel>
<panel name="cond-text-panel" width="30%" height="30" ypos="5%" xpos="10%">
<text name="condition-text" alias="CONDTEXT" height="100%" width="100%" color="#707B51" font="Helvetica-Bold" size="18" align="left" alignment="left" text="condition" fit="yes"></text>
</panel>
<panel name="woeid-text-panel" width="30%" height="30" ypos="5%" bordercolor="#707B51" borderwidth="1" rightof="cond-text-panel" padding="5%">
<textfield name="woeid-text" text="12786794" kbtype="numberpad" onreturnkeypressed="updateWOEID" alias="NEWWOEID" height="100%" width="100%" color="#707B51" font="Helvetica-Bold" size="18" align="left" alignment="left" placeholder="Type new WOEID" fit="yes"></textfield>
</panel>
</panel>



<if lhs="[datasource:RSSFeed.1.*[local-name()='condition']/@code]" operator="e" rhs="02">
<videocontrol type="play" file="video/Gillham.mp4" target="VID-FRAME" />
</if>
<if lhs="[datasource:RSSFeed.1.*[local-name()='condition']/@code]" operator="e" rhs="03">
<videocontrol type="play" file="video/CrownCenter.mp4" target="VID-FRAME" />
</if>
Try assigning the code value as a variable first and then using that in your if statement queries.

For example:

<assign property="var:code" value="[datasource:RSSFeed.*[local-name()='condition']/@code]" />

<if lhs="[var:code]" operator="e" rhs="02">
<videocontrol type="play" file="video/Gillham.mp4" target="VID-FRAME" />
</if>
<if lhs="[var:code]" operator="e" rhs="03">
<videocontrol type="play" file="video/CrownCenter.mp4" target="VID-FRAME" />
</if>