Sunday, November 16, 2014

How to stop Silverlight videos via Javascript

I was exploring on how to stop the video that is being played within silverlight via javascript. I couldn't find any straight cut sample on stop function. However, updating or resetting source seems to do the trick !!!

You have to set id for your object tag

<object id=''videoID" ......>

Then I used jquery to set the source

$('#videoID').get(0).source = "<your xap file location>"

You can achieve the same using javascript as below

var videoElement=document.getElementById("videoID");
videoElement.source="<your xap file location>"

No comments:

Post a Comment