Saturday, 27 July 2013

Video Play on Page Load using SWF player

<h2>Video Play on Page Load</h2>
<script src="@Url.Content("~/Content/video/jwplayer.js")"></script>
<script src="@Url.Content("~/Content/video/jquery-latest.js")"></script>
<script type="text/javascript">
    $(document).ready(function () {
        var videoPath = "@Url.Content("~/Content/Video/")";
        jwplayer("video_player").setup({
            flashplayer: videoPath + "player.swf",
            autostart: true,
            file: videoPath + "welcome.mp4",
            height: 344,
            width: 495
        });

        jwplayer().onComplete(function () {
            _gaq.push(['_trackEvent', 'Clicks', 'Video Player', 'Watched video till end']);

        });

        jwplayer().onPlay(function () {
            _gaq.push(['_trackEvent', 'Clicks', 'Video Player', 'Video Played']);

        });

        jwplayer().onPause(function () {
            _gaq.push(['_trackEvent', 'Clicks', 'Video Player', 'Video Paused']);

        });
    });
</script>

<div id="video_player">Loading the player ...</div>
Include Jquery latest file: http://www.4shared.com/document/rXvQEdmV/jquery-latest.htm ,
swf player and 
jwplayer js file: http://www.2shared.com/complete/ZT7n-cEV/jwplayer.html

No comments:

Post a Comment