duration

Video selection from gallery: Limit only videos up to 30 seconds should be selected

China☆狼群 提交于 2019-12-04 16:16:48
How can I control videos up to 30 seconds should be selected else show Toast/Popup. I can get video's path in onActivityResult and can run video but can't get duration. Any suggestion, below is my code: case Utils.REQUEST_CODE_GALLERY_VIDEO: if (resultCode == Activity.RESULT_OK) { Uri selectedVieo = data.getData(); String[] filePathColumn = { MediaStore.Video.Media.DATA }; Cursor cursor = getContentResolver().query(selectedVieo, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); String filePath = cursor.getString(columnIndex);

Javascript returns NaN for audio duration depending on request sequence

二次信任 提交于 2019-12-04 12:00:25
I'm very new to Javascript. I haven't had much success finding an answer to my query. Here's a description of the problem. I create an audio element and set the source to an .m4a file. The .m4a file is able to both load and play successfully. I get strange results, however, when requesting the source audio duration. The following javascript produces 'NaN' in Chrome: //Create audio element based on HTML audio id and modify controls accordingly var aud = document.getElementById("storyTime"); aud.setAttribute("src",story.audioTitle); console.log("DEBUG: Audio Duration = " + aud.duration); //Get

Login, logout and duration time in php and mysql?

百般思念 提交于 2019-12-04 06:03:02
问题 I would like to store the login, logout and duration time in database. The login time is created when the user is authenticated(successfully logged in) The logout time is created when the user clicks the logout button The duration is logout - login time. (logout minus login) But the problem is, what if the user didnt click the logout button. Here are the situations: Internet loss Close the browser/tab. (I need this must use javascript, but i donnu how to do it, any idea?) EDIT: I forgot to

Change jQuery's animation duration during animating

左心房为你撑大大i 提交于 2019-12-04 04:51:24
Is it possible to change the duration of a currently running jQuery animation between two different values? I've tried to change the duration via direct assignment, but no success: var timing = { duration: 4000 }; $(document).click(function (e) { timing.duration = 1000; }); $('#foo').animate({top:200, left:200}, timing); ...and even, changing the fx.options.duration in step -method does not affect the running animation: var state = false, $(document).click(function (e) { state = true; }); $('#foo').animate({top:200, left:200}, { duration: 4000, step: function(now, fx){ if(state) fx.options

What is the value of the ISO 8601 duration `P1M` (in seconds)?

╄→尐↘猪︶ㄣ 提交于 2019-12-04 04:40:57
问题 Suppose I have an ISO 8601 duration, expressed as "P1M" . Phrased colloquially, this means "one month." Is there a standard rule for converting this into a number of seconds, assuming the start date is not known? For 30-day months, it might be 2,592,000. For 31-day months, it might be 2,678,400. In February, it might be 2,419,200 or it might be 2,505,600. My gut says there's no way to resolve "one month" to an exact number of seconds without knowing context, and where those seconds are laid

GraphViz Dot very long duration of generation

半城伤御伤魂 提交于 2019-12-04 04:21:05
I have a tree structure I want to be generated by Dot. Each node has 4 edges to another 4 nodes. In sum there are about 1,000 nodes. If I try to generate it with Dot it takes a very long time (once I let it work like for a hour - CPU usage was 100% all the time but it didn't finish). Is there a way to accelerate this? Maybe by setting down the quality? Or using another (faster?) vizualization software? I've attached my Dot file for you to test it on your own machine. Thank you. Dot File: http://lh.rs/3fmsfjmbvRw2 You may want to try setting the nslimit or nslimit1 attributes as mentioned here:

Calculate Duration

廉价感情. 提交于 2019-12-04 03:31:39
I have a small android problem, I have a requirement to have a timer to calculate the duration from the time a specific activity was open till a certain button in that activity is clicked, simply how long the activity was open. While googling around I found TimerTask but this seems to run a thread for a certain interval only though and doesent seem ideal for the job from my little Android experience Any idea on how to calculate the duration? Preferably in a very simple manner Any help is very welcome Regards, MilindaD Just use System.currentTimeMillis() to capture the time when the activity

Getting mp3 file length

让人想犯罪 __ 提交于 2019-12-03 21:32:02
问题 I am currently trying to write an Audio Player in C#. I am using BASS library to deal with playing music but now i have small problem with getting length of the song. Well i have read BASS doc and found a way: "All" i need to do is int stream = Bass.BASS_StreamCreateFile(filepath,....); int length = Bass.BASS_ChannelBytes2Seconds(stream, Bass.BASS_ChannelGetLength(stream)); And in most of cases i get valid length of song. And here the problem starts. As far as i know the stream creation

Groovy time durations

给你一囗甜甜゛ 提交于 2019-12-03 14:30:16
问题 Hi I'm trying to calculate the difference (duration) between two times in Groovy. e.g. start = "2010-10-07T22:15:33.110+01:00" stop = "2010-10-07T22:19:52.356+01:00" Ideally I would like the get the duration returned in Hours, Minutes, Seconds, Milliseconds. Can anybody please help. I've tried to use Groovy's duration classes but have not been able to make any progress. Thanks for your assistance. 回答1: If you just want to find the difference between two times you create yourself (for instance

How to measure and display the running time of a single test?

房东的猫 提交于 2019-12-03 09:40:52
问题 I have a potentially long-running test written with scalatest : test("a long running test") { failAfter(Span(60, Seconds)) { // ... } } Even if the test finishes within the timeout limit, its running time can be valuable to the person who runs the test. How can I measure and display the running time of this single particular test in scalatest's output? Update: Currently I measure the running time with my own function, just as in r.v's answer. I'd like to know if scalatest offers this