-MultimediaDemo - sample.MP4 (n00b) could not be found

Hello! I'm a n00b here, so please forgive the stupid question...

I'm trying to get the sample working MultimediaDemo, and I am pulling my hair out trying to get the Simulator to find the sample.mp4 file.

When I debug I get error: CAFETERIA: sample.mp4 is not found

When he tries to run: getResourceAsStream("/sample.mp4") (complete code below)

My folder structure is:

.. Mm2/src/com/rim/samples/multimediademo/MultimediaDemo.Java

.. Mm2/src/com/rim/samples/multimediademo/sample.MP4

Issues related to the:

1. where should I put the sample.mp4 file so that it is? (I tried almost everywhere I can think of, without success..)

2. where on a real BB the "correct" location corresponds to?

Thank you

Tom

p.s. I read the ref lang (below) and I still don't understand...

getResourceAsStream

public InputStream getResourceAsStream(String name)

Looking for a resource with a given name. This method returns null if no resource with this name is found. The rules looking for resources associated with a given class are specific profile. RIM implementation notes: this method searches the resource from the directory in which the current JDP project file is located. By default, it is assumed that this JDP file resides in the parent directory of the package of the current project space. Thus, the package space tree (for example, com/rim/PackageName) is added to name so that the search begins from this space package, that is, in the source directory of the current project. However, if the current JDP project file does not lie in its presumed location, the behavior above prevent the resource located. In this case, the user must add a slash (/) in the name of the resource before calling getResourceAsStream. This treats the name as an absolute path, which is compared to a tree whose root is the location of the JDP file.

package com.rim.samples.multimediademo;

/** * MultimediaDemo.java * Copyright (C) 2001-2008 Research In Motion Limited. All rights reserved. */import java.io.InputStream;

import javax.microedition.media.Manager;import javax.microedition.media.MediaException;import javax.microedition.media.Player;import javax.microedition.media.PlayerListener;import javax.microedition.media.control.VideoControl;import javax.microedition.media.control.VolumeControl;

import net.rim.device.api.system.Characters;import net.rim.device.api.ui.Field;import net.rim.device.api.ui.MenuItem;import net.rim.device.api.ui.UiApplication;import net.rim.device.api.ui.component.Dialog;import net.rim.device.api.ui.component.EditField;import net.rim.device.api.ui.component.LabelField;import net.rim.device.api.ui.component.Menu;import net.rim.device.api.ui.container.MainScreen;

public final class MultimediaDemo extends UiApplication {    public static void main(String[] args)     {        //create a new instance of the application        //and start the application on the event thread        MultimediaDemo theApp = new MultimediaDemo();        theApp.enterEventDispatcher();    }

    public MultimediaDemo()     {        //display a new screen        pushScreen(new VideoScreen());    }}

//create a new screen that extends MainScreen, which provides//default standard behavior for BlackBerry applicationsfinal class VideoScreen extends MainScreen implements PlayerListener{    //declare variables for later use    private Player _player;    private VideoControl _videoControl;    private VideoManager _videoManager;    private Field _videoField;    private EditField _eventField;    private EditField _volumeField;    private int _currentVolume; 

    public VideoScreen()     {        //invoke the MainScreen constructor        super();        // add a screen title        LabelField title = new LabelField("Multimedia Demo 2",                        LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);        setTitle(title);

        //display Player events          _eventField = new EditField("Event: ","",40,EditField.READONLY);        add(_eventField);

        //Initialize _currentVolume        _currentVolume = 50;

        //display current Player volume        _volumeField = new EditField("Volume: ",""+_currentVolume,20,EditField.READONLY);        add(_volumeField);

        try         {            //Get local video file resource            Class playerDemoClass = Class.forName("com.rim.samples.multimediademo.MultimediaDemo");            InputStream inputStream = playerDemoClass.getResourceAsStream("/sample.mp4");

            //Create a new Player from the InputStream            _player = Manager.createPlayer(inputStream,"video/mp4");

            //Realize Player            _player.realize();

            //Add listener to catch Player events             _player.addPlayerListener(this);

            //Get the Player VideoControl            _videoControl = (VideoControl) _player.getControl("VideoControl");

            //Initialize video display mode             _videoField = (Field) _videoControl.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE,"net.rim.device.api.ui.Field");

            //Set the video display size to 200 x 200            _videoControl.setDisplaySize(200, 200);

            //Create a manager for the video field            _videoManager = new VideoManager();            _videoManager.add(_videoField);            add(_videoManager);

            //Set video control to visible            _videoControl.setVisible(true);

            //Start the Player            _player.start();

            //Set up Player volume            setVolume(_currentVolume);        }         catch (Exception e)         {            System.out.println("foo" + e.getClass());        }    }

    //override onClose() to cleanup Player resources and display a dialog box    //when the application is closed    public boolean onClose()    {        //Cleanup Player resources         //try block         try         {            //Stop Player            _player.stop();        }        //catch MediaException        catch (MediaException e)         {            e.printStackTrace();        }

        if (_player != null)         {            //Close Player            _player.close();            _player = null;        }        Dialog.alert("Goodbye!");        System.exit(0);        return true;    }

    //set the volume level for the Player    private void setVolume(int level)     {        //get the Player volume control and set the volume level        VolumeControl volumeControl = (VolumeControl) _player.getControl("VolumeControl");        volumeControl.setLevel(level);

        //Update _volumeField        _volumeField.setText(""+level);    }

    //increase the Player volume by 10    private void volumeUp()     {        _currentVolume += 10;        //Set _currentVolume to a valid value if it's out of range        if (_currentVolume > 100)         {            _currentVolume = 100;        }        //Set Player volume to _currentVolume        setVolume(_currentVolume);    }

    //decrease the Player volume by 10    private void volumeDown()    {        _currentVolume -= 10;        //Set _currentVolume to a valid value if it's out of range         if (_currentVolume < 0)         {            _currentVolume = 0;        }        //Set Player volume to _currentVolume        setVolume(_currentVolume);    }

    //create a menu item for switching Player to full screen mode    private MenuItem _fullScreen = new MenuItem("Full Screen",200000,10)     {        public void run()         {            //try block            try             {                //switch Player to full screen mode                _videoControl.setDisplayFullScreen(true);            }             //catch MediaException            catch (MediaException e)             {                e.printStackTrace();            }        }                   };

    //create a menu item for users to pause and resume playback     private MenuItem _pauseItem = new MenuItem("Pause/Resume", 200000, 10)     {        public void run()        {                  //Start or stop the Player based on the Player state            //try block            try             {                //if current Player state is STARTED stop the Player                if (_player.getState() == Player.STARTED)                 {                    _player.stop();                }                 //else if current Player state is PREFETCHED start the Player                else if (_player.getState() == Player.PREFETCHED)                {                    _player.start();                }             }            //catch MediaException            catch (MediaException e)             {                e.printStackTrace();            }        }    };

    //create a menu item for users to close the application    private MenuItem _closeItem = new MenuItem("Close", 200000, 10)     {        public void run()        {            onClose();        }    };

    //override makeMenu to add the new menu items    protected void makeMenu( Menu menu, int instance )    {        menu.add(_pauseItem);        menu.add(_fullScreen);        menu.add(_closeItem);    }

    //override keyControl to handle volume up and down key presses    protected boolean keyControl(char c, int status,int time)     {       //Handle volume up and down key presses to adjust Player volume       //if volume up is pressed call volumeUp()         if (c == Characters.CONTROL_VOLUME_UP)         {            volumeUp();            return true;        }        //else if volume down key is pressed call volumeDown()         else if (c == Characters.CONTROL_VOLUME_DOWN)         {            volumeDown();            return true;        }         //else call the default keyControl handler of the super class        else         {            return super.keyControl(c, status, time);        }    }

    //catch Player events and display them in the _eventField    public void playerUpdate(Player player, String event, Object eventData)    {        //Update _eventField with the current event        _eventField.setText(event);    }}

//Manager to lay out the Player _videoField on the VideoScreenfinal class VideoManager extends net.rim.device.api.ui.Manager {    public VideoManager()     {        super(0);    }

    //lay out the _videoField on the screen based on it's preferred width and height    protected void sublayout(int width, int height)     {        if (getFieldCount() > 0)         {            Field videoField = getField(0);            layoutChild(videoField, videoField.getPreferredWidth(), videoField.getPreferredHeight());        }        setExtent(width, height);    }}

.. Mm2/src/com/rim/samples/multimediademo/MultimediaDemo.Java

.. Mm2/src/com/rim/samples/multimediademo/sample.MP4

The above structure seems good. Just to confirm, did you add sample.mp4 to your project?

Tags: BlackBerry Developers

Similar Questions

  • Definition mx.messaging.channels:RTMPChannel could not be found.

    I get this error in Flex Builder 3: mx.messaging.channels:RTMPChannel definition could not be found.

    <? XML version = "1.0" encoding = "utf-8"? >
    "" < mx:Application xmlns:mx = ' http://www.adobe.com/2006/mxml ' layout = "absolute" width = "416" height = "276" viewSourceURL = "srcview/index.html" >
    < mx:Script >
    <! [CDATA]
    Import mx.messaging.channels.RTMPChannel;

    I'm in the right forum? If so, any ideas?
    I have included C:/inetpub/wwwroot/weborb30/weborbassets/wdm/weborb.swc in the flex build path. If that helps.

    I'm just trying to get my first sample of work that uses Remoting to access a .NET mxml or actionscript object.
    Thank you
    Greg

    I got my app to work. I put comment out this line and added a new one for remote access. RemoteObject which is what I think video/demo of the midnightcoder indicated anyway;

    Import mx.messaging.channels.RTMPChannel;
    Import mx.controls.Alert;
    Import mx.rpc.events.ResultEvent;
    Import mx.rpc.events.FaultEvent;
    Import mx.rpc.remoting.RemoteObject;

  • Mac App Store: The Apple ID, you have entered could not be found...

    I just upgraded to Sierra and get this error when I try to upgrade all the apps in the Mac App Store:

    The Apple, ID you entered could not be found or your password is incorrect. Please try again

    The password is correct, as I can check my account with the password of the feature > menu account

    im not sure what to do, I tried a restart of the computer, I disconnected the Mac App Store, but nothing seems to work.

    Reset my AppleID and restarting (twice) corrected that.

    https://iforgot.Apple.com/

  • Error message on one of my two Windows 7 PC, 64-bit. "The Apple software update server could not be found.  "Check your internet settings and try again.  Can someone advise?

    These last messsage of error on one of my two Windows 7 PC, 64-bit. "The Apple software update server could not be found.  "Check your internet settings and try again.  My second Windows 7 PC Apple Software Update works normally.  The Apple software update version is 2.2.0.150.  Can anyone tell how to fix this?

    I have the same problem and I don't want to lose my content. App Apple Software Update doesn't work

  • Error message @ boot Win 7 Pro "it was Aproblematique from C:\programdata\ofpviaowu.dat - the specified module could not be found."

    Error message @ boot Win 7 Pro "there was a problem starting C:\programdata\ofpviaowu.dat - the specified module could not be found."

    This error message appears whenever I have start my computer and windows starts (Firefox doesn't start up). 15.01 Firefox work properly otherwise.

    This started after I installed the 15.0.1 patch.

    I uninstalled and reinstalled Firefox but the problem remains. Search Google for "ofpviaowu.dat" came with "2012-08-29 Firefox version 15 startup Crash Report" as the only listing.

    Is this a Firefox problem?

    My system has this file: C:\ProgramData\Mozilla\logs\. I don't think that Firefox or update service should write directly to the root of C:\ProgramData\. It could be a configuration error, or it could be completely different.

    You may be able to remove your boot sequence problem .dat file using Microsoft Autoruns utility: Autoruns for Windows. If you find an entry, can describe you it?

  • There is a problem of backup applications to iTunes to my new iPhone 6 s. apparently, there is an error that says that the applications could not be found. Why can't I make the backup?

    There is a problem of backup applications to i Tunes (previously synced from my iPhone 6) to my new iPhone 6 s. apparently, there is an error and the applications could not be found. How to solve this?

    Are the 6 and 6 times on the same iOS?

    ITunes is also the last version 12.3.3?

  • Apple software update server could not be found

    I get the very annoying error message on the update to the latest version of iTunes on my computer Ultimate de Windows 7 32 bit 12.3.3.17. "The Apple software update server could not be found. Check your Internet settings and try again. "My program of the Apple software update is 2.2.  I tried a repair it and iTunes without result. Any suggestions?

    It seems to be widespread. USS worked for me and even used to update iTunes earlier this week, it still worked after that. But this morning the error appears when you try to ASU on all our machines. The reason that it seems that the latest version of iTunes is to blame is I think as part of its installation is ASU updated to the latest version, after which the server problem. I contacted the support apple via Twitter, maybe that others should do the same to add weight to the issue. what I've read, it seems that a server AKMAI problem is to blame. Hope that this problem is fixed soon.

  • Time machine could not complete the backup of... The backup disk image could not be found (error (null))

    Running OS 10.11.3 on my early 2011 Macbook Pro 2.7 GHz Intel Core i7 with 4 GB 1333 MHz DDR3, use Time Machine to back up to my Airport 802.11ac purchased 16/09/2014:

    Backup failed: Time Machine could not complete the backup of... Airport Time Capsule.   The backup disk image ' / Volume/Data/MacBookPro.sparsebundle ' could not be found (error (null)).   Last successful backup: yesterday at 12:17

    I can see the airport and the data file in my network.

    I immediately did a full time Machine backup on a USB key and it disconnected from my system.

    I unplugged the airport, let it rest for a minute and returned the power plug, let it settle for a green light.  I'm restarting Time Machine backup to the airport.

    I need to replace the airport?  The appliance starts to fail?  Or, it is more likely is a problem with winter static electricity that has damaged the image and reconstruction will fix all this.  Reconstruction will take about four hours with no guarantee that it will work.

    Please see #C17 in this document great support... http://pondini.org/TM/troubleshooting.html

  • I get this error message, the backup disk image "/ Volumes/data-1/jackmatz of Air.sparsebundle of MacBook ' could not be found (error (null)).

    Hey get this error message

    The backup disk image "/ Volumes/data-1/jackmatz of Air.sparsebundle of MacBook ' could not be found (error (null)).

    In the context of what?

  • The backup disk image ' / Volumes/Data/iMac.sparsebundle ' could not be found (error (null))

    Hello

    I have a 27-inch iMac late 2013, 3.2 Ghz intel Core i5, 8 GB 1600 Mhz DDR3. I get the tracking error when you try to save it on my time capsule.

    The backup disk image ' / Volumes/Data/iMac.sparsebundle ' could not be found (error (null))

    I have another iMac and Mac Pro that save in the capsule of time without any problem.

    Can anyone help?

    Thank you

    You try Time Capsule stop and unplug for 1 minute. Then reset the SMC on the iMac by Intel iMac LANDAU and SMC will reset and restart the iMac and restart the TC and retest Time Machine.

  • to restart my macbook air early 2015 in windows 8.1 to begin the installation it tells me that usb drivers could not be found, what should I do?

    to restart my macbook air early 2015 in windows 8.1 to begin the installation it tells me that usb drivers could not be found, what should I do?

    It downloads everything and restarts in windows 8.1, then when I click on install now a message pops up saying that miss me the disk drivers important that I don't know what to do

    This is an incorrect error message. Please post the exact error message or a screenshot of the error, if possible.

    See also no drivers were found and the reference to AppleSSD.sys.

  • H8-1050Z: totalform.dll module could not be found

    I ran a Norton 360 and it deleted adware.adpopup and now I get the message, there was a problem starting c:\users\carl\appdata\local\total form\bin\totalform.dll the specified module could not be found at boot.

    I ran two cleaners registry (REgistry First Aid and SmartPCFix) but this has not fixed the problem.  No idea where the system is looking for this dll so I can get rid of him?

    Hello

    You are welcome!

    I checked your journal and found the problem. Norton deleted some unwanted/malicious file, but did not remove the entry totalform in the WIndows Task Scheduler. Once remove you it, it stops with annoying messages.

    Please open Autoruns and wait for the analysis short finish.

    Once ready, scroll down to "Task Scheduler."

    You will find an entry (probably highlighted in yellow) regarding

    "\Total form" "file not found: C:\Users\Carl\AppData\Local\Total Form\Bin\TotalForm.dll.

    Right click on this yellow line and choose Delete. Confirm if necessary.

    Close the Autoruns

    Make sure that you can see the hidden files and folders. Operating instructions here:

    > http://www.bleepingcomputer.com/tutorials/how-to-see-hidden-files-in-windows/

    > http://www.bleepingcomputer.com/tutorials/how-to-see-hidden-files-in-windows/#win7

    Open my computer/Windows Explorer, go to C:\Users\Carl\AppData\Local and manually remove a folder called Total form

    Once ready, restart your computer, and you will notice that the problem will be solved.

    Provide feedback

  • MSG for error in Windows 7: "unable to load DLL 'Gpib - 32.dll': the specified module could not be found."

    Hi people, I have a project in VB. NET (VS2010 specifically), which has been updated from an old VB6 project. The old project

    use Niglobal.bas and Vbib - 32.bas to communicate with the GPIB plugged into one of our litters.
    Now in the 64-bit Win7 with the Niglobal.bas and the Vbib - 32.bas converted to Niglobal.vb and Vbib - 32.vb,.

    I get an error when debugging to

    Public void RegisterGPIBGlobals()

    in the Vbib - 32.vb, the error msg says:

    Unable to load DLL 'Gpib - 32.dll': the specified module could not be found. (Exception from HRESULT: 0x8007007E)

    It seems like this Gpib - 32.dll, that I found under SysWOW64 on my Win7 is not designed for a 64-bit application and when I copy this dll file on

    C:\Windows\System32, the msg of error becomes:

    An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

    So I think my question is double: 1. the drafting of my own app in VB. NET can I still use Gpib - 32.dll (including the Niglobal.vb and Vbib - 32.vb)?

    2 Will the application I am writing with .NET work in x 64 Windows 7?

    The Almighty gurus and Mods please help. Thank you!

    Hi Joel, thanks for the answer! I have the 3.0.2 driver.

    I was looking around for a while after I posted here and further in the use of NI4882 manual, page 4-4, I found this:

    «To bring an application in an environment 64-bit requires the application to migrate the NI4882 API and be recompiled.»

    So I'm ditching the gpib - 32.dll (vbib - 32 & niglobal) and currently I am using NI4882.dll and restructuring of my project.

  • Dragon Wizard could not be found x 1 new

    Hello

    When I click on the vise command button in the Panel of key Adaptive he I get message dragon Wizard could not be found.

    Is there a way to fix this?

    Thank you

    ADMIN EDIT - please see the solution - download link since the Lenovo support site.


  • nianlys.dll could not be found on Windows 7

    I'm having trouble installing my application on a particular computer. I sent this request several times on a number of computers, but in this particular case, I get an error when you run the program-

    "System.DllNotFoundException: unable to load DLL 'nianlys.dll': the specified module could not be found." (Exception from HRESULT: 0x80070007E)

    • I made sure that nianlys.dll is present in C:\Program Files (x 86) \National Instruments\Shared\Analysis.
    • I made sure that libiomp5md.dll and LV110000_BLASLAPACK.dll, mkl.msm files, are present. nianlys.dll also has a dependency on nimetautils.msm, but I do not know what DLLs are included in this.
    • I made this program is installed by running setup.exe as administrator (as opposed to run the .msi file that is generated, see here).
    • I assured that the computer in question is aware of updates of .net framework via windows update.
    • I tried to reinstall the program several times, sometimes with a newly recompiled Installer.
    • I tried to add in the 64-bit nianlys.msm in the Setup manually - project this generates an error because the project's TargetPlatform property Installer is set to x 86. The 32-bit version is, of course, already present in the detected dependencies.
    • Interestingly, taking a copy of nianlys.dll to C:\Program Files (x 86) \National Instruments\Shared\Analysis and insertion in the directory that the program is installed in throws up a different error - in this case, the error is "an attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) ».
    • Take a copy of the 64-bit version of nianlys.dll from another computer (default location C:\Program NIUninstaller Instruments\Shared\Analysis) and by inserting in the directory that the program is installed in throws a third type of error - ' System.DllNotFoundException: unable to load DLL 'nianlys.dll': a dynamic link library (DLL) initialization routine failed. " (Exception from HRESULT: 0x8007045A) ». It is worth noting that this .dll was present before installing the program on the machines that the program works, but is not * present on the target computer, throwing problems.
    • Taking the same 64-bit nianlys.dll and insert it in the location that it was found on another computer, C:\Program NIUninstaller Instruments\Shared\Analysis, do not resolve the original error.
    • Interstingly even more, I have tried to reproduce the error on a computer on which the program is running - remove the x 64 version of nianlys.dll get the original HRESULT: 0x80070007E error, while remove the x 86 version is a Windows Installer appear when you run the program.
    • On a computer on which the program works without any problem, windows Task Manager does not appear to indicate that the program is 32-bit (with the * suffix 32 on the name of the program), despite the platform target to x 86 value.

    It seems all that there is a problem with the nianlys.dll used in both the x 64 and x 86, despite the target platform versions only being x 86. I'm really running out of ideas on this sort of thing I could try to fix this problem, any help would be most appreciated.

    Okay, problem has been resolved - see the solution to the overflow of stack here. Basically, the program was running 64-bit instead of 32-bit, and as a result of the x 64 nianlys.dll and Associates x 64 dependencies were absent.

Maybe you are looking for