Background file upload in Blackberry WebWorks - blackberry

I'm writing a Blackberry Z10 app for use in onsite events where we take photos or short videos of attendees and the photos are available immediately on a website. We take the photo, enter a message to be displayed with it and the photo gets uploaded right then. We initially used blackberry.io.filetransfer.upload but the videos could be up to 30MB so would have a long wait time, so we switched to an XHR transfer where we could have a progress bar so at least the app user would have something to look at.
We've found that sometimes they're in areas with low connectivity, so would like to just copy the file to a folder that is watched by a background process and anything deposited there gets uploaded to the server. How can we get an app functioning basically as a service, doing file transfers even when minimized?

Related

Should I use local videos or youtube videos

I'm developing an iOS app that is going to use plenty of videos. The app in summary is a quiz app, where after each question it shows your a video relevant to that question.
my question is, should I use local videos or just referencing youtube links to show the videos? keep in mind that all of the videos that I am going to show are youtube videos that I have already downloaded and added to the app bundle.
what are the benefits and downfalls of each? in terms of app development and user interaction?
Most of the things that you need to consider are
Size of the app with all videos inside. If you add everything in the
bundle than the size of the application will be big and some people
will reject to download it especially if they are not in wifi
network
Do you need these videos if you don't have a network? If yes, you
have two options, the first one to add everything in the bundle and the second one to download them inside the app when the app starts.
What about the speed? Is it okay to wait for the stream or you need instant play?
I think these are the 3 main points for this. (Size, Offline, Speed)
If you have everything in the bundle Offline support and speed of playing will be okay. But for sure you can have a problem with the size. If everything is in youtube the size will be fine but then you will have problems with the speed and the offline mode.

Screen recording when my iOS app is in background with ReplayKit

I have tried Broadcast Extension. I have added that extension via target. But, I don't know how to record when my app is in background.
Two ways I am trying to record:
Via Control center: I can see my app’s target name, after selecting that name, then I start to record by clicking Start Broadcast, next by clicking Stop Record, but my video not getting stored either in Camera Roll or in my app. Ref Link: ReplayKit's RPSystemBroadcastPickerView not showing preferredExtension
Via my app: Once press Start button, recording get started, I am trying to record background from my app by clicking home button, obviously recording has been stopped. Ref Link: https://medium.com/#giridharvc7/replaykit-screen-recording-8ee9a61dd762.
There is no "direct" way to store video in your app while it is in the background. ReplayKit version 2 allows you to get video sample buffer pieces in the app extensions that calls "Broadcast Upload Extension". When you say "Via Control center" it means that you start broadcast (not recording), and at the same time iOS finds your app-extension (not your application) and launch it, then begins send video sample buffers to the extension. On this step you need to decide what to do with these buffers.
I can propose two solutions for you:
you can try transfer buffers to the server (and download video when
main application will be launched)
you can try save buffers to the file using App Groups (to share
this data with the main application), you can find example
here.
But you need to know that broadcast extension has been designed for buffer transferring, not to store or re rendering or compress or recode buffers. Extension has a lot of limitations based on CPU time and Memory usage (±50 MB), you can try to do anything there but if it is "heavy" operation iOS will close the extension.

Is it possible to initiate an upload when app is suspended?

Here is the user experience I am hoping to achieve: In my app user can take some photos and upload them to Amazon S3. It is likely that user won't have internet available at that time (nature of app and target market). So I want to store those photos in device if internet is not available and automatically start uploading them whenever internet is available.
And this is where I need help: How can I achieve this? If not completely, how much closer can I get to this user experience? Like stores the photos and start uploading when users opens the app next time or show a notification when internet is available, then user can tap on it to open app and start uploading etc.
Additional information: Each upload will take ~1 minute to complete. After an upload is complete I also need to make an http request (if that matters).
Yes, this is possible. Look into URLSessionUploadTask:
Upload tasks are similar to data tasks, but they also send data (often in the form of a file), and support background uploads while
the app is not running.

Rails streaming and uploading at the same page

I have a page where users see the uploaded videos. Above the videos, there is an "Update" form with the ability to upload videos to the collection. The form uses realtime uploading (Upload starts as soon as user chooses file). And when the upload progress is 100%. The user hits "Update" button to update video collection.
The problem occurs when the user wants to upload a file when watching a video. The upload does not progress. There are no messages or errors in server development log or client javascript console. It just hangs (the video continues playing though). The upload usually hangs at the start (5%, 20% depending on the video file size).
By the way; i use refile gem for managing realtime uploads, storage, file serving, etc. Also it should be known that, i use same rails application server (Thin 1.6.3) to serve files and accept uploads. (Maybe the server gets busy and can not accept uploads? Because if i don't start playing the video, the upload progresses smoothly and completes without a problem.)
Could anyone point me in the right direction? Where to look? Are there any parameters i should set somewhere?

Caching streamed movie on iPhone

In a few days I'm supposed to start working on a new app and one of the requirements seems a bit odd to me. User will be able to watch streamed videos that my client also has on his site. Problem is, app has to save it and later, when user is offline, he should have the option to watch it again. Any ideas how am I supposed to save that (streamed) movie to memory?
Edit: The movie can even be 1 hour long.

Resources