Download and save audio and video files

Hello

I am trying to record audio and video files that are larger than 5 MB in size.

I open a Http connection and asking to 128 KB each time until the completion of the data transmission.

for some files that are 1 to 2 MB code does not work well, but if you have large files MB it throws the error, ' Eception Exception: myApp Application (201) does not; process is completed"

How can I fix this error. I searched the forum for this error, I found some funda but has not found a solution.

AM making ala invokeAndLater() and therefore not blocking is not the eventThread.

Here is the flow of my code that establishes the connection and starts to download.

the following code snippet shows the flow of the code.

// Constructor: displays a popup screen that allows the user to select a list of audio/video files for the download. 

// Dictionary obj is a vector that contains list of file names.// IAudioVideoPopUp is an interface implemented by the caller. 

public AudioVideoPopUp(Dictionary[] v, IAudioVideoPopUp guideIntroManager)  {     super(new VerticalFieldManager());        if( v!= null)     {         caller = guideIntroManager;           for(int i =0; i< v.length; i++)            {             btnFileNames = new MyButtonField(v[i].value.toString(), "images/button1_big.png", "images/button2_big.png",  true, Font.PLAIN, 18, v[i]);             btnFileNames.setChangeListener(new FieldChangeListener()              {                     public void fieldChanged(Field field, int context)                    {                     if(field instanceof MyButtonField)                        {                         final MyButtonField tempField = (MyButtonField) field;                            UiApplication.getUiApplication().popScreen(UiApplication.getUiApplication().getActiveScreen());                           synchronized (UiApplication.getEventLock()) {                             UiApplication.getUiApplication().invokeLater(new Runnable(){                                  public void run()                                 {                                     UiApplication.getUiApplication().pushScreen(new WaitScreen());                                        caller.onClick(((MyButtonField) tempField).getDictionaryData());                                  }                             });                           }//                           PopupCloseThread pct = new PopupCloseThread(field);//                         pct.start();                      }                 }             });               add(btnFileNames);            }

          btnCancel = new MyButtonField("Close", "images/button1.png", "images/button2.png", true, Font.PLAIN, 18);         btnCancel.setChangeListener(new FieldChangeListener()             {                 public void fieldChanged(Field field, int context)                {                 UiApplication.getUiApplication().popScreen(UiApplication.getUiApplication().getActiveScreen());               }         });           add(btnCancel);       }

   }
// onClick method that was implemented in the caller. 

// dictionary is a vector, contains info about the selected file in the popup.

public void onClick(Dictionary dictionary)   {     if(dictionary != null)        {         switch(ContentType)           {         case 1:               playAudio(dictionary);                break;            case 2:               videoSelected(dictionary);                break;            default:              break;            }     } }
// the following code calls for the downloading and saving of the file.

private boolean downloadAndSaveVideo(long movieID2, String fileName, String URL, int fileSize)    {     if(URL!= null)        {         try           {             String videoFileURL = AppConstants.SDCARD+AppConstants.CONTENT_PATH+fileName;             if(new DownloadCombiner(URL, videoFileURL, 128*1024).run())               {                 return updateVideoTable(movieID2, videoFileURL);              }         }             catch (Exception e)           {             Tools.print("XCO: GuideIntroManager: downloadAndSave: Error..:" + e.toString());          }     }     return false; }
// this is not a thread class. // here an repeatdly making the requests to get all the data.// please go thru the run().

public DownloadCombiner(String remoteName, String localName,         /*int connection,*/ int chunksize)    {     this.remoteName = remoteName;     this.localName = localName;       this.chunksize = chunksize;   }

public boolean run()     {     boolean result = false;       try       {         int chunkIndex = 0;           int totalSize = 0;

          /*             * File connection             */           FileConnection file = (FileConnection) Connector.open(localName);         if (!file.exists()) {             file.create();            }         file.setWritable(true);           OutputStream out = file.openOutputStream();

         /*             * HTTP Connections            */           String currentFile = remoteName; //+ connectionType();            Tools.Debug("Full URL: " + currentFile);          HttpConnection conn;          InputStream in;           int rangeStart = 0;           int rangeEnd = 0;         while(true)           {             Tools.Debug("Opening Chunk: " + chunkIndex);

              conn = (HttpConnection) Connector.open(currentFile,Connector.READ_WRITE, true);

              rangeStart = chunkIndex * chunksize;              rangeEnd = rangeStart + chunksize - 1;

              Tools.Debug("Requesting Range: " + rangeStart + "-" + rangeEnd);

              conn.setRequestProperty("Range", "bytes=" + rangeStart + "-"+ rangeEnd);

              int responseCode = conn.getResponseCode();                if(responseCode != 200 && responseCode != 206)                {                 Tools.Debug("Response Code = " + conn.getResponseCode());                 break;                }

              Tools.Debug("Retreived Range: "+ conn.getHeaderField("Content-Range"));

              in = conn.openInputStream();              int length = -1;              byte[] readBlock = new byte[256];             int fileSize = 0;

              while((length = in.read(readBlock)) != -1)                {                 out.write(readBlock, 0, length);                  fileSize += length;                   //Thread.yield(); // Try not to get cut off               }             totalSize += fileSize;

              Tools.Debug("Chunk Downloaded: " + fileSize + " Bytes");              chunkIndex++; // index (range) increase               in.close();               conn.close();             in = null;                conn = null;              /*                 * Pause to allow connections to close and other Threads to run.               */               //Thread.sleep(1000);         }         Tools.Debug("Full file downloaded: " + totalSize + " Bytes");         if(totalSize>0)            {             result = true;                Tools.Debug("Wrote file to local storage");           }else{                result = false;               file.delete();            }         out.close();          file.close();     }         catch (Exception e)       {         result = false;           Tools.Debug(e.toString());        }

      return result;    }

A little patience please.  Don't forget that you are awake does not mean that other people are.  I'd leave a Thread open for at least 24 hours before bumping.

I'm sorry to tell you that invokeLater runs the executable on the wire of the event, not a separate Thread.  If you have actually started the treatment in the very thing you're trying to get away from.

You must run the execution in DownloadCombiner treatment in a separate Thread.  This is why, in the article, which I suppose you DownloadCombiner, it extends Thread.

Just for the record, DownloadCombiner is here:

How - to download large files using the BlackBerry Mobile data system
Article number: DB-00619
http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800431/How_To _...

Tags: BlackBerry Developers

Similar Questions

  • Audio and video files that has already worked on my computer no longer works.

    Audio and video files that has already worked on my computer no longer works and I get one of the three messages which are as follows:

    (1) the file can be used (but it is not used by another program, and then media player that I use to try to read the audio/video file)

    (2) you may not have access to the location of the file (and yet I am the administrator of the computer, I am the only user with access to the computer and I installed the files myself and they have worked fine up until now.)

    (3) your proxy setting may be incorrect (I use automatically detect my proxy settings that is the same settings I use for my network and the Internet.)

    All of the files in question worked previously but now continue to show these problems. If anyone can give me any information as to how I can get these files restored to their values of work please feel free to respond below or send a personal email with your solutions to * address email is removed from the privacy *

    Yours,

    Brent

    Hi Brent,

    You can try to uninstall last updates window who installed or do a system restore to a point before the updates have been installed and then install updates one by one to see which update is causing the problem.

    Method 1:

    You can read the following article to remove an update.

    Remove an update

    Method 2:

    If you cannot uninstall the updates, then you can try to perform a restore of the system to a prior restore point you have been affected by the issue.

    Note: When you perform the system restore to restore the computer to a previous state, programs and updates that you have installed are removed.

    To run the system restore, you can consult the following link:

    System restore

    System Restore: frequently asked questions

    Method 3:

    Try to install updates one at a time to see the update is causing the problem.

    Install Windows updates

    Hope this information is useful.

  • Windows Media Player unable to play audio and video files

    Codec Windows Media Player 11 (wmp11) problem

    Hi, I'm with windows media player 11 and I installed the codecs ffdshow, vista codec package and klite codec... but I would not be able to play some audio files and video files.

    Could you please give us the link to the full package of codec for windows media player 11 (wmp11)

    Thanks in advance.

    Hello

    Use the CCCP codec as above and if you need for a particular file type, then after a
    message here and/or use Google.

    -Free - CCCP also get free tool of insurgents
    http://CCCP-project.NET/

    -----------------------------------------------------------------------

    Have you tried to use VLC which needs no codec for most files.

    I hope this helps.

    Rob Brown - MS MVP - Windows Desktop Experience: Bike - Mark Twain said it right.

  • Center of Windows 7 media won't play audio or video files

    A month ago, everything was fine, but then a wave of updates for Windows 7 has essentially killed my Media Center.  It is no longer sees my audio files and gives me an audio error when I try to access the library.  He sees my video files, but then gives me a video error.  Still, Windows Media Player can play audio and video files.  I have tried a system restore, went into the control panel and or power off the components of the system, ran the command prompt to use sfc/scannow, nothing helps.  Anyway I can just clean the Media Center and download an uncorrupted version?

    System specifications: Acer Aspire R3700 Windows 7 X 64
    Concert w/2.0 Intel Atom D525 1.8 GHtz CPU CPU RAM

    Hello

    Thanks for posting the question in Microsoft Commuity!

    We start with a few questions:

    1 have had any changes made on the computer before the show?

    2. What is the full and exact error message?

    3. What is the format of audio and video files?

    Method 1:

    See the article and try to run the Troubleshooter:

    Audio problems in Windows Media Center

    http://Windows.Microsoft.com/en-us/Windows-Vista/troubleshoot-audio-problems-in-Windows-Media-Center

    This article also applies to Windows 7.

    Method 2:

    Update the latest Codecs and see if the problem still occurs:

    Note: using third-party software or a link, including hardware drivers can cause serious problems that may prevent your computer from starting properly. Microsoft cannot guarantee that problems resulting from the use of third party software or link can be resolved. Using third-party software or a link is at your own risk.

    Method 3:

    I would also suggest update you the audio and display drivers and check if it helps:

    Updated a hardware driver that is not working properly

    http://Windows.Microsoft.com/en-us/Windows7/update-a-driver-for-hardware-that-isn ' t-work correctly

    Let us know if it helps. If you are always faced with the question, please answer and we will be happy to help you.

    Thank you.

  • Dell xps l502x freezes making buzzz sound during playback of the audio or video file

    I have a two year old dell laptop xps l502x, who recently started producing some strange audio buzzz at regular intervals during playback of audio or video file.le sound is very similar to the sound when games used to freeze with the same anonying buzzz sound which is a very well known with the XPS L502X.i used only to have problem that the sound during games used to hang , but recently it has begun to occur during playback of audio or video files too.

    RTZ87,

    I just had a quick glance and the solution is in the thread below. Uninstall 'Dell Support help' and 'Dell Support Assist Agent'. They have been automatically installed on your laptop in the last two days and seem to be causing the problem.

  • If I instal Windows 10, I lost all my data such as audio or video files?

    If I instal Windows 10, I lost all my data such as audio or video files?

    Hello

    If you have a system that is qualified for the upgrade and then no. you will not lose any data. However, it s recommended you back up your system files and data that you want absolutely without danger, because things can always go wrong.

    I hope this helps! Don t forget to mark as answer, if she did.

    Yuri

  • When considering a project containing audio and video files in movie maker vista project freezes and thaws randomly

    When considering a project containing audio and digital photos in movie maker in vista, the project freezes and thaws at random. How to ensure that there is a smooth and uninterrupted presentation.  The presentation will last 30 minutes.  I don't have this problem when creating the project

    Try Publishing (save) project in the. Film WMV
    format and see if it will play in Windows Media Player.

    See the following articles:

    Windows Vista - publish a movie in Windows Movie Maker
    http://Windows.Microsoft.com/en-us/Windows-Vista/publish-a-movie-in-Windows-Movie-Maker

    Movie Maker Vista - Edition
    http://www.Papajohn.org/Vista-publishing.html

    If you use "Windows Live Movie Maker"... See the
    following video tutorial:

    How to save the project in Windows Live Movie Maker
    http://www.YouTube.com/watch?v=ZyqZm5MBc7o FWIW... If you have used. Music mp3... There could be
    problems of compatibility... converting them to the. WMA
    format before you import into Movie Maker can be useful to
    a test:

    There are many converters available on the net... the
    the following link is an example:

    (FWIW... it's always a good idea to create a system)
    Restore point before installing software or updates)

    Format Factory (freeware)
    http://www.videohelp.com/tools/Format_Factory
    (the 'direct link' is faster)
    (the file you want to download is: > FFSetup295.zip<>
    (FWIW... installation..., you can uncheck
    ('all' boxes on the last screen)
    (Windows XP / Vista / 7)

    First... after the download and installation of Format
    Factory... you can open the program and
    left click on the toolbar, the "Option" button and
    "Select an output folder to" / apply / OK.
    (this is where you find your files after they)
    are converted)

    Drag and drop your music files on the main screen...

    Select "while"WMA"/ OK...

    Click on... Beginning... in the toolbar...

    That should do it...

  • HELP V3 - 572 G Windows 10 update NO SOUND and wont play any audio or video file

    Hello world

    I just upgraded to windows 10, very nice update and don't usually return to 8.1, but unfortunately not windows programs will play files, audio or video of any kind and when you use VLC Player or youtube videos, the files will play but no sound?

    I checked all the regular suggestions such as the properties of the device and it claims to work fine etc., sound is not mute, except pass by and update drivers I don't know where to go from here.

    I was going to do a reset, keep my files, remove applications and settings, etc., I was warned it would remove apps, but a lot of what seems to be crucial drivers/programs will have to be re-installed manually. Also after doing a reset, you lose the ability to go back to 8.1

    Since when they were abducted during a reset?

    Any help is very appreciated,

    see you soon

    Jessie

    Uninstall your Realtek drivers and install the latest audio driver Realtek available here:

    http://www.station-drivers.com/index.php/downloads/func-startdown/1618/

    Web site, 100% reliable, you must extract the files, double-click on the exe and the balance sheet to create a folder on the file setup.exe

  • Satellite Pro A120: DVD/CD burner does not burn audio and video files

    Hello

    I have the Satellite Pro A120 with a cd/dvd burner MAT * a uj-8415. It works very well with data Brüning, but...

    When you try to burn the MP3 files or video files on DVD or CD/r or any type of audio file, it suddenly gives me an error message telling me that the cd can no longer be used.

    I tried hole Sonic (RecordNow), through Nero 6, and also directly by dragging and dropping files, but all was in vain. This MATI * a uj-8415 machine has also made the same error while burning a DVD double layer.

    Again, the unit reads all types of CD and DVD and writes also all types of files with the exception of the audio and video.

    Can you help me please to solve this problem?

    Hello

    I know that some mp3 files and audio are protected against copying and burning on different CDs or DVDs so could not work? ¦

    Other reasons why you can't write these files to CD or DVD is simply a problem of compatibility between the STRANGE and the CD or DVD.
    According to my experience, not all CD or DVD is supported, and these compatibility issues are not really rare.

    I also have another idea.
    Have you heard of burning of problems caused by the bad registry entry? I mean the upper and lower filters...

    Please check this doc MS:
    http://support.Microsoft.com/kb/270008/en-us

    Completely remove the Upperfilters and Lowerfilters from the following registry key values:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contro l\Class\ {4D36E965-E325-11CE-BFC1-08002BE10318}

    .. .and see if it helps.

  • Audio and video file export question.

    When I export my video, I'm MPEG2 1080 p Blu - Ray, but after that he implemented that it exported video file and one audio file, how do I get to stay together, while keeping the 1080 p? Thank you

    For Bluray it is set by default on two files in the burning software as yet he prefers a single file.

    If you want a single value TS Multiplexer in the export settings.

    If you have a bluray, bluray H.264 will give you sharper images.

  • Download and view files PDF IOS 9.2

    Since downloading the iOS 9.2 update, I've noticed that I'm unable to download and view pdf files. I tried my account on my phone of colleagues (running iOS 9.1) that does it without problem. The server is the Exchange 2003 server. Has anyone else seen elsewhere? Anyone know a fix?

    We are having the same problem with some PDFs on Exchange 2003. The workaround of Acrobat to download the full message and press open in the player does not work. One or more of the following actions occurs:

    • The PDF file is as is the download (circle progresses / completes)
    • Tapping/long-press the PDF icon does nothing
    • The error "cannot download the attachment"

     

    Temporary workaround on 6s 9.2: open in Outlook Web Access in Safari, tap and hold the link to the PDF, open in new tab temporary until access OWA is removed.

    Cannot open some PDF files:

    (JW) iPhone 6 s, iOS 9.2, Exchange 2003, no. AirWatch Agent (AWA)

    (RJ) 5 s, iOS 9.2, AWA 5.0.3

    (MC) 5 s, iOS 9.2, AWA 5.0.3

    Can open the PDF file, the others cannot:

    IPhone (KB) 6, iOS 8.3, Exchange 2003, AWA 5.0.3

    (SD/DEM) 6, iOS 9.2, Exchange 2010, AWA unk

    (MC) 6, iOS 9.1, Exchange 2003, no AWA

  • How can I keep the photo files id3 tagging? (And video files?)

    Hello.

    This question is about id3 tagging files photo (and video?). Probably, it revolves around managing the media too.

    I have tif and jpg files that I took of the old and the new point and shoot cameras. What I'm trying to do, is to have jpg and tif of the originals. Make some changes and have a jpg and tif amendment. So I have 4 files for each image (2 independent is the original and 2 Edition). I want a lossy and lossless for each file.

    I've bothered to fill out somethings in the id3 tagging. When I tried some changes in batches to get the files, id3 tags was empty.

    I use Windows XP SP3 Home Edition 32-bit. I tried to use FormatFactory to an export batch. I use Corel PaintShop Photo Pro X 3 also, who gave the same results.

    In Windows XP: I right click on the file, the Properties tab, I think it's the details. In my view, title, author, subject, keywords, comments. It's the id3 tagging which not copied.

    When I right click and COPY a file, it keeps the id3 tags.

    I really think there's a way to deal with this. Anyone use? Nobody cares? Need scripts and a certain program? I don't think that I would have to pay for it. How professionals and more or less experienced people do it?

    I don't want a markup that is recognized by some programs. I can do that already, but it is too advantageous. I won't tag id3 4 times. I don't want a watermark.

    Are the methods or rules identical for Win Vista, Win7 or Win8? I have 32-bit and 64-bit Vista Home Premium, but have not tried it on there. I have to start the migration of files again. Vista is choose with id3 tagging anyway from what I tried. I keep said that Win7 is similar or the same.

    I thank you very much.

    A place to start...

    When a photo is copied... a new version of the file is created.
    During this process, some software will remove metadata
    in the file properties.

    The only insurance that I can think of would be to make a backup of the
    metadata, then restore the metadata if it is deleted.

    The following freeware has not been updated in a long time, but is
    a proven method to backup metadata.  Also the site
    suggests other alternatives.

    Exifer for Windows
    http://www.Friedemann-Schmidt.com/software/Exifer/

    Good luck...

  • Windows 7 - can't delete old photos, music and video files in Windows Media Player

    using computer Windows 7 and current Windows Media Player - given to me after the mine crashed and burned.  Went through all the settings (have everything set up right after that) but I have files Photos, music and videos that belonged to the person who owned it before.  He left the area and while I don't want to show files (what they are - don't know, don't care) I don't want to get out of here.  MASSIVE amount of files.  No matter what I seem to do they will not erase.  I have tried everything I can think of short of wiping the thing and starting over.  Help! Suggestions - idea short of dumping in the trash (setting fire to him or by running a truck, ect...) to clean this thing would be GREATLY appreciated...

    Mike

    The best thing you can do with a used computer that gave you is to access the recovery partition and reinstall the default unit. Most of the laptops brand will have a reserved recovery Partition built into the main HARD disk that can be used to restore the computer to right-of-factory default. Usually activated by touching a certain key during the boot process or by using the software provided by the computer manufacturer.

    Dell uses Ctrl + F11 at the Dell logo screen to initiate the restore process. HP uses a program in Windows 7, called Manager of recovery. Your system may vary depending on the manufacturer.

    Don't forget to get all documents (including images) and any other personal information that you want to keep. Several key software product can be recovered with the Belarc Advisor before the restore, but you will need to locate the diskettes (CD/DVD, ISOs or exe) installation for each piece of software.
  • Works writing Maske in swf and video - Datei nicht fonts mask does not work in the swf and video files

    Hallo,

    ICH habe eine writing-Maske standing. In der Voransicht auf der Zeitleiste looks man die Maske,.

    Wie sie richtig should be.

    Aber in exportierten und swf videos. Dateien wird die Maske non dub.

    Was mache ich please.


    Hello

    I created a signature mask. In the Preview on the timeline, you can see the mask,
    as it should be correct.
    But in exported swf videos. files the mask does not work.

    What I am doing wrong.



    ocak.jpgtest1.jpg

    I don't see anything that looks like a mask on your stage effect.

    in general, I think the image hidden (below OCAKBAŞI) is visible and nothing else.  you have two other visible layers makes it difficult to see what you are trying to demonstrate.

    text mask problems generally, because the text is not broken down into vector shapes (by clicking on edit > to break > to break).

  • I have two portable hard drives with music and video files and cannot get them to play

    I have two portable hard drives with music and movies files can get them to play my laptop girlfriend see them, but does not play

    If you copy the files on the portable hard drive will they play?

Maybe you are looking for