How to clone a videoPlayer trackbar?
-
First of all, HNY2019 to codeproject comunity. You are doing a very good job! I am learning how to use WindowsMediaPlayer control. My (new) track bar is a fixed length (200px) Empty control with a Paint red rectangle inside it, that updates videoplayer Current time. I am stuck at a strange point that i cant manage to see the solution. I bet is a simple solution and i am too tired and foggy to see it right now. The problem is the Maximum Length of the Movie. It is changing every time when i load a new movie, right so far? Now, my fixed track bar has 200px. How do i make 200px into 1600 int length? So sorry for my bad english explanation. Basically, i want to clone a videoPlayer trackbar. Thank you.
-
First of all, HNY2019 to codeproject comunity. You are doing a very good job! I am learning how to use WindowsMediaPlayer control. My (new) track bar is a fixed length (200px) Empty control with a Paint red rectangle inside it, that updates videoplayer Current time. I am stuck at a strange point that i cant manage to see the solution. I bet is a simple solution and i am too tired and foggy to see it right now. The problem is the Maximum Length of the Movie. It is changing every time when i load a new movie, right so far? Now, my fixed track bar has 200px. How do i make 200px into 1600 int length? So sorry for my bad english explanation. Basically, i want to clone a videoPlayer trackbar. Thank you.
You're not cloning anything. All you're doing is mapping a number range onto another number range, or a simple percentage. Your trackbar simply goes from 0 to 100%. This is grade school math. At 200 pixels wide, each pixel represents 0.5%. When your video is playing, you get the percentage played by dividing the number of seconds played by the total number of seconds in the video. You'll get a number between 0 and 1, your percentage played.
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave Kreskowiak -
You're not cloning anything. All you're doing is mapping a number range onto another number range, or a simple percentage. Your trackbar simply goes from 0 to 100%. This is grade school math. At 200 pixels wide, each pixel represents 0.5%. When your video is playing, you get the percentage played by dividing the number of seconds played by the total number of seconds in the video. You'll get a number between 0 and 1, your percentage played.
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave Kreskowiak -
It's simple. You played 1200 seconds of a 1600 second video. That's 1200/1600 = 0.75, or 75% of the video played. Your trackbar is 200 pixels wide, for 100%, so each pixel represents 0.5%, or put another way, 2 pixels represents every 1%. So, you draw your marker 75 * 2 pixels over from it's start.
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave Kreskowiak -
First of all, HNY2019 to codeproject comunity. You are doing a very good job! I am learning how to use WindowsMediaPlayer control. My (new) track bar is a fixed length (200px) Empty control with a Paint red rectangle inside it, that updates videoplayer Current time. I am stuck at a strange point that i cant manage to see the solution. I bet is a simple solution and i am too tired and foggy to see it right now. The problem is the Maximum Length of the Movie. It is changing every time when i load a new movie, right so far? Now, my fixed track bar has 200px. How do i make 200px into 1600 int length? So sorry for my bad english explanation. Basically, i want to clone a videoPlayer trackbar. Thank you.
Simple: each pixel in your trackbar represents a variable amount of time: 0.5% of the total length of the movie. So if your movie is 55 minutes and 37 seconds long, each pixel represents (55 * 60 + 37) * 0.005 == 16.685 seconds. If your movie is 2 hours, 12 minutes, and 14 seconds long, then each pixel is (((2 * 60) + 12) * 60 + 14) * 0.005 == 39.67 seconds Get the idea?
Sent from my Amstrad PC 1640 Never throw anything away, Griff Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!
-
It's simple. You played 1200 seconds of a 1600 second video. That's 1200/1600 = 0.75, or 75% of the video played. Your trackbar is 200 pixels wide, for 100%, so each pixel represents 0.5%, or put another way, 2 pixels represents every 1%. So, you draw your marker 75 * 2 pixels over from it's start.
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave Kreskowiak -
Simple: each pixel in your trackbar represents a variable amount of time: 0.5% of the total length of the movie. So if your movie is 55 minutes and 37 seconds long, each pixel represents (55 * 60 + 37) * 0.005 == 16.685 seconds. If your movie is 2 hours, 12 minutes, and 14 seconds long, then each pixel is (((2 * 60) + 12) * 60 + 14) * 0.005 == 39.67 seconds Get the idea?
Sent from my Amstrad PC 1640 Never throw anything away, Griff Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!
-
You're welcome!
Sent from my Amstrad PC 1640 Never throw anything away, Griff Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!
-
You're welcome!
Sent from my Amstrad PC 1640 Never throw anything away, Griff Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!
another devil now - with progressBarX1_Click. And...Resolved! I wish i can Delete this thread. The "delete" link Button from the top, is showing this time(Haleluia), but is greyed out and I can not use it. Probably is a thing for those with money. I am thinking too much probably. :) But seriously, this is a ... (my) fart thread, that i wish to smudge it.
-
another devil now - with progressBarX1_Click. And...Resolved! I wish i can Delete this thread. The "delete" link Button from the top, is showing this time(Haleluia), but is greyed out and I can not use it. Probably is a thing for those with money. I am thinking too much probably. :) But seriously, this is a ... (my) fart thread, that i wish to smudge it.
No, it's simply that you can't delete any post with a response: it would leave the response "hanging in midair" with no support, screaming and wetting itself in terror (Posts are scared of heights, as I'm sure you know). And of course you have no authority to delete other peoples posts, so you can't get rid of it!
Sent from my Amstrad PC 1640 Never throw anything away, Griff Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!