SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru phantom007's Avatar
    Join Date
    May 2008
    Posts
    739
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Question JwPlayer :: Exact postition with getPosition()

    HI

    I was able to get the position of the video by using the jwplayer().getPosition() function but I get something like 171.97 but the timer on the video showed me 2:51. How can I exactly get the position as 2:51 instead of 171.97?

    Screenshot: http://i.imgur.com/NzMxk.png

    My Code:

    Code:
    <script type="text/javascript">
    		jwplayer("mediaplayer").setup({
    			flashplayer: "player.swf",
    			file: "mane.mp4",
    			image: "preview.jpg",
                            events: {
                             onPlay: function(event) {
                                timeMsg();
                             }
                            }
    		});
    
    
                    function timeMsg()
                    {
                        var t=setTimeout("alertMsg()",100);
                    }
                    function alertMsg()
                    {
                        var timeline =  ( jwplayer().getPosition());
                        $('#position').text(timeline);
                        timeMsg();
                    }
    
    	</script>


    Any help is appreciated.

  2. #2
    SitePoint Member
    Join Date
    Jan 2013
    Location
    Coimbatore, Tamil Nadu, India
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cool jwplayer calculate time in seconds

    Hi

    it is showing you right answer
    jwplayer calculate position in seconds
    2:51.... will be 120sec+51sec=171sec
    171.97 sec is exactly right


    hope that helps
    for more information on jwplayer api check the link below

    http://www.longtailvideo.com/support...api-reference/

    Quote Originally Posted by cancer10 View Post
    HI

    I was able to get the position of the video by using the jwplayer().getPosition() function but I get something like 171.97 but the timer on the video showed me 2:51. How can I exactly get the position as 2:51 instead of 171.97?

    Screenshot: http://i.imgur.com/NzMxk.png

    My Code:

    Code:
    <script type="text/javascript">
    		jwplayer("mediaplayer").setup({
    			flashplayer: "player.swf",
    			file: "mane.mp4",
    			image: "preview.jpg",
                            events: {
                             onPlay: function(event) {
                                timeMsg();
                             }
                            }
    		});
    
    
                    function timeMsg()
                    {
                        var t=setTimeout("alertMsg()",100);
                    }
                    function alertMsg()
                    {
                        var timeline =  ( jwplayer().getPosition());
                        $('#position').text(timeline);
                        timeMsg();
                    }
    
    	</script>


    Any help is appreciated.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •