I'm trying to export several minutes of video in an AVAssetExportSession and it's taking a long time. My ideal way of doing this is pausing the AVAssetExportSession when the app closes and resuming it when the app reopens. Is there any way to pause an AVAssetExportSession, save its state, and reload it later?
Related
We have a 64 Bit .Net Application which is a Windows Form. The UI has a Live Video display which shows every Frame from a USB Camera using a delegate eventhandler. Frames are sent to this UI at 60 frames /sec.
We have a need to stop the Live update whenever Windows Locks out due to the screen saver settings.
Code is all in C#.
We do know that the SystemEvents.SessionLock/Unlock does the trick for us. OR we could also use the WM_WTSSession_CHANGE through the WTSRegisterSessionNotification API's. Either way it is supposed to do the same work of letting the UI know that Windows has Locked or Unlocked.
All good so far.
The issue is when the Live Video is being updated, the SessionChange Events never gets to the WndProc() method or the SystemEvents SessionSwitch eventhandler.
If I stop the Frame updates, then the events work perfectly fine.
Yes the Frames being updated are on the GUI Thread using the InvokeRequired checks.
Result is the App crashes when Windows Locks out, because we didn't process the events in 5secs(MS recommendation). I have tried many options of getting it to process the events with some luck however its very inconsistent.
This is a kind of threading issue where the Frames updating is not allowing the Session events to be processed.
Any ideas on how we can look into these session events before Frame updates? or on how do we solve this so the UI can process the Session events?
Your suggestions are much Appreciated.
Update:
If I force a lock(click Ctrl+Alt+Del) and log back in the Session Events are received. Just does not happen on Screen saver Lock.
I am Working on Background task in Windows phone application but it is not calling .When do launch for test it is working but in real scenario app is not calling background services.
Do you use ScheduledActionService.LaunchForTest? This function is not supposed to work on a real phone. You have to deal with the fact that instead of running every 1-2 minutes your background task will be launched once every 30 minutes or so as stated in Constraints For Periodic Agents section.
If everything is fine in your simulator, you have to cross your fingers and keep waiting for a half of hour or so just to test that you are actually launched. Yes, it's a pain to debug, but we have no other official way.
You may also try adjusting local time on device. Sometimes going half an hour into the future helps trigger background agent immediately.
I am working on a timer application where i have used 5-6 timers running at one time, I need all the timers running at the same time. For ex. calculating a time, updating the UI etc.
But this is hangs my app, After some time, its started not responding.
Then i quit the app and re-launch but this time i didn't start the timer (Only one timer is running) and i found that application is fine this time.
I think the issue is due to usage of multiple timers at the same time as these timers are updating the UI frequently after every seconds. I need to updated my label with the updated time, but how i could do this without using an NSTimer. If NSThread is an option then please give me an example to achieve this.
I'd like to know if it is possible to switch from foreground app to background agent and vice-versa sharing some data from these two tasks?
More in deep I'd like to do an upload that starts from foreground (Fig. A) and when the user pushes back button the upload continues with background agent (Fig. B).
Image is here: http://imageshack.us/f/823/testter.jpg/
Background file transfer is what you need. It can upload (and download) files while the application is not running:
With Windows Phone OS 7.1, applications are able to queue up one or
more file uploads or downloads over HTTP that will be executed in the
background, even when the application is no longer running in the
foreground. The APIs used for initiating file transfers should be used
to query the status existing transfers and provide progress indicators
for the end user.
You do realize that you can't update the tile constantly from a PeriodicTask right? The minimum refresh time is 30 minutes, unless you do push notifications (which I here, assume you won't, since it's a client-side operation).
And the tile itself doesn't make much sense. And I don't think using a task that can maximum run for 25 seconds makes a aweful lot of sense either for uploading a file.
So I guess we can conclude that it'll not be possible to do this. Instead , you should allow the application to run in the background, by setting the ApplicationIdleDetectionMode to Disabled
PhoneApplicationService.Current.ApplicationIdleDetectionMode = IdleDetecetionMode.Diabled"
Then the user can press the Home button, and the download will progress in the background.
With the new WP 7.1 they added Background Agent to play sound files from within your application, and TaskScheduler Agent to run tasks periodically.
However:
I want to play sounds periodically even if my application is closed.
TaskScheduler does not allow to play audio via XNA sound effects, BackgroundAudioPlayer or MediaElement (http://msdn.microsoft.com/en-us/library/hh202962%28v=vs.92%29.aspx)
TaskScheduler runs for a specific time with a FIXED interval of 30 seconds. I need to play a sound every hour on the hour.
Alarms can have a sound set to them, but there is no way to customize that dialog to not show and not need snooze or dismiss functionality.
There's no way to play sounds from a Background/Live Agent as there is no way to implement the required UI prompts that would be needed to satisfy the marketplace certification requirements around other music which may be playing on the device at the time.
In theory you could create the functionality you are after with an hour long track that is mostly silent which you play via a background audio player. In reality though this would likely be a big drain on the battery and would prevent the user playing other music.
If you can explain why you want to do this we may be able to make alternative suggestions.
Also note that the length of time a scheduled agent can run for is a MAXIMUM of 15 seconds every 30 minutes (plus or minus 10 minutes).
Is there now a possibility to play the sound on the setting timer even if we close the application ?