duration

Java: How to convert a string (HH:MM:SS) to a duration?

Deadly 提交于 2019-11-26 16:42:01
问题 i want to convert a string with a format of HH:MM:SS or MM:SS or SS into a datatype of Duration. solution: private ArrayList<Duration> myCdDuration = new ArrayList<Duration>(); private void convert(String aDuration) { chooseNewDuration(stringToInt(splitDuration(aDuration))); //stringToInt() returns an int[] and splitDuration() returns a String[] } private void chooseNewDuration(int[] array) { int elements = array.length; switch (elements) { case 1: myCdDuration.add(newDuration(true, 0, 0, 0,

Convert seconds to human readable time duration

扶醉桌前 提交于 2019-11-26 16:33:42
问题 How would I best convert 90060 (seconds) to a string of "25h 1m"? Currently I'm doing this in SQL: SELECT IF( HOUR( sec_to_time( sum(time_to_sec(task_records.time_spent)) ) ) > 0, CONCAT( HOUR(sec_to_time(sum(time_to_sec(task_records.time_spent)))), 'h ', MINUTE(sec_to_time(sum(time_to_sec(task_records.time_spent)))), 'm' ), CONCAT( MINUTE(sec_to_time(sum(time_to_sec(task_records.time_spent)))), 'm' ) ) as time FROM myTable; But I'm not sure it's the most convenient method :-) I'm open to

Getting length of video

感情迁移 提交于 2019-11-26 14:08:13
问题 I am having trouble finding a simple example of how to get the video length of a file programmatically. Many people say, oh use this library/wrapper or whatever, but do not say how. I have downloaded ffmpeg, but have no clue how to actually use it and there does not seem to be any example of how to use it to get the video duration. I see how you can use it to convert videos, but I simply just want to know the duration of a video. All of the other information does not matter. Is there any way

What is the duration of a Toast LENGTH_LONG and LENGTH_SHORT

橙三吉。 提交于 2019-11-26 14:02:29
问题 I need the exact duration of LENGTH_LONG and LENGTH_SHORT in milliseconds (ms). Also I need to know if the duration of Toast message with LENGTH_LONG will have the same duration in any phone and with any API version. Does someone know where is the duration defined ?, I mean defined in ms . I know that LENGTH_LONG is some int const with value 1. But I could not find where is the actual duration defined. 回答1: Answered here. Like you mentioned Toast.LENGTH_SHORT and Toast.LENGTH_LONG are not in

How to get video duration from mp4, wmv, flv, mov videos

时光怂恿深爱的人放手 提交于 2019-11-26 12:44:43
问题 Alright. Actually i need mostly the mp4 format. But if it is possible to get for other types as well that would be nice. I just need to read the duration of the file. How can i do that with C# 4.0 ? So the thing i need is like this video is like : 13 minutes 12 seconds I can use 3 third party exes too. Like they save the information about the file to a text file. I can parse that text file. Thank you. 回答1: You can use DirectShow API MediaDet object, through DirectShow.NET wrapper library. See

JFormattedTextField : input time duration value

夙愿已清 提交于 2019-11-26 12:31:58
I want to use a JFormattedTextField to allow the user to input time duration values into a form. Sample valid values are: 2h 30m 72h 15m 6h 0h However I am having limited success with this. Can some one please suggest how this can be accomplished? I am OK if this result can be achieved using a JTextField as well. Thanks! If it is worth anything, here's my current attempt: mFormattedText.setFormatterFactory( new DefaultFormatterFactory( new DateFormatter( new SimpleDateFormat("H mm")))); This sorta works except that: I cannot get h and m to appear as plain text (I tried escaping) * The number

Formatting a Duration in Java 8 / jsr310

假如想象 提交于 2019-11-26 12:31:05
问题 I am transitioning a project from Joda-Time to java8\'s native time libraries, and I have run into a snag. I have been unable to find a formatter for Duration. I would like to have a custom String format of, for instance, HHH+MM , where a Duration of 75 hours and 15 minutes would format as \"75+15\" . This was easy to do with Joda-Time by converting to period, and using a PeriodFormatter, but I have been unable to find this type of class in Java8. Am I missing something? 回答1: There is no

How to get video duration, dimension and size in PHP?

若如初见. 提交于 2019-11-26 12:06:16
I want to know how to get the duration, dimension and size of uploaded video file in PHP. The file can be in any video format. aendrew getID3 supports video formats. See: http://getid3.sourceforge.net/ Edit: So, in code format, that'd be like: include_once('pathto/getid3.php'); $getID3 = new getID3; $file = $getID3->analyze($filename); echo("Duration: ".$file['playtime_string']. " / Dimensions: ".$file['video']['resolution_x']." wide by ".$file['video']['resolution_y']." tall". " / Filesize: ".$file['filesize']." bytes<br />"); Note: You must include the getID3 classes before this will work!

current/duration time of html5 video?

寵の児 提交于 2019-11-26 09:30:36
问题 I need a way of getting the total time length of the video and the current time with jquery and displaying it in a couple of <div> tags. <div id=\"current\">0:00</div> <div id=\"duration\">0:00</div> I\'ve been searching all day and I know how to get them I just can\'t display them. #jquerynoob 回答1: HTML: <video id="video-active" class="video-active" width="640" height="390" controls="controls"> <source src="myvideo.mp4" type="video/mp4"> </video> <div id="current">0:00</div> <div id=

html5 display audio currentTime

依然范特西╮ 提交于 2019-11-26 09:23:31
问题 I would like to display the current time of of an html 5 audio element and the duration of that element. I\'ve been looking over the internet but can\'t find a functional script which allows me to display how long the audio files is and what the time currently is e.g. 1:35 / 3:20. Any one got any ideas :)? 回答1: Here's an example: <audio id="track" src="http://upload.wikimedia.org/wikipedia/commons/a/a9/Tromboon-sample.ogg" ontimeupdate="document.getElementById('tracktime').innerHTML = Math