Hi guys, I was wondering if someone could tell me how I can calculate video playback time if I know the file size and streaming rate? For example the video file size is 1500KB which plays at 2400Kbps Thanks in advance. Danny
Hmmm...I worked this out but if I made a mistake I'm sure some nice person will inform me... You have a playing rate of 2400 kbps (which is thousand bits per second)... So this is really 2,400,000 bits per second Since there are 8 bits in a byte...this translates to 2,400,000 bits per second / 8 bits in a byte = 300,000 bytes per second. Now, 1,500 KB is 1,500,000 bytes, So playing 1,500,000 bytes at 300,000 bytes per second equates to 1,500,000 / 300,000 = 5 seconds! Hope that helps (and hope I got it right!)
This is how you can do it inside your video player with actionScript 3: var totalSeconds:Number = flvControl.playheadTime; var totalSeconds2:Number = flvControl.totalTime; var minutes:Number = Math.floor(totalSeconds /60); var minutes2:Number = Math.floor(totalSeconds2 /60); var seconds = Math.floor (totalSeconds) % 60; var seconds2 = Math.floor (totalSeconds2) % 60; if (seconds < 10){ seconds = "0" + seconds; } if (seconds2 < 10){ seconds2 = "0" + seconds2; } timeBox.text = minutes + ":" + seconds + " / " + minutes2 + ":" + seconds2; } Code (markup): flvControl = Your video MC timeBox = Dynamic Text Box Hope this helps you...