libvlc api calls failing without Sleep - visual-c++

I am working on integrating Media Player into my MFC dialog box.The dialog box is created from a dll which wraps libvlc.My problem is after I set the output window to a static control in dialog and play the media it works fine.But other API calls like getting length and getting time fails if I call it from my methods.But as soon as I introduce a Sleep(100),everything seems to work.I am wondering what could be the issue.What i want to do is play video between user provided timeline(i.e. if user want only 5 minutes of video out of 15 minutes length between time A to time B).
The sleep seems to work fine but there is always an unwanted delay in playback that I do not want.Please if somebody can give pointers on how to achieve this.

The Sleep works if I have worker threads running in my application.But if I handle the working through the libVLC event handler it works fine without Sleep.Seems like I am missing a very fundamental logic here but since this works for now,I will go with this. Thank you all.

Related

How to start and stop a video as well as a Timeline with Vuforia?

I am very new to Unity / Vuforia scripting and really need help.
I have composed a whole Timeline in unity but cannot trigger an event ... there are still code errors ...
In the DefaultTrackableEventHandler script, I understand that you have to attach a piece of code that allows these events to be triggered but I haven't been able to do this for 48 hours. Help from the community would be very useful. please.
Here is the scenario:
When launching the application a video should appear. When the target is found, the video should stop to leave room for the Timeline which is triggered automatically, since the target has been found. If the user loses the target then the Timeleine will have to stop and the starting video will have to start again.
Someone could help me with this problem that has taken my head for 48 hours ...
thank you so much
Looks like you have to write scripts that contains differents functions that manage all those points. One script that starts and stops your video (2 different functions), and a other that starts and stops your timeline. (Don't forget to hide the video when you stop it)
Once you have those scripts you can attach them to a object and then, use them in DefaultTrackableEventHandler. (You add you function to the right event by clicking the + button, dragging your object with the script and choosing the right function to use).
Screenshot of DefaultTrackableEventHandler

CodedUI Keyboard.SendKeys() sends Keys Randomly

This was always working up until now...
I am testing a web Application and need to enter Users Name into HTMLEDIT control
KeyBoard.SendKeys(control,"Alice");
this enters Name as "AAAicce"
I am using VS2013,This was working fine with VS2010.
Please suggest what is going wrong here.
It happens when control is not in Focus. You can try clicking on control and then sending keys to make sure it goes to right control.
Have you tried setting the delay? For example:
Keyboard.SendKeysDelay = 1000; // 1-second delay between keystrokes

showing Wait Screen using LWUIT in J2ME?

Is there any way of showing Wait Screen, while some processing is done in backend, using LWUIT in J2ME ? if yes then how if no then is there any alternate ?
You can look at progress bar with LWUIT. Sample Wait screen used in the makeover demo and the browser demo application in current LWUIT Repository. Also see here.
I had this issue as well, but got a workaround: these suggestions here seemed not to be the best for me. The dialog when it displays will block any other action except it is discarded, even if it was created with no commands.
What I did was to add a wait screen to the BorderLayout.CENTER of the main container or the Form, then when the thread running my background task finishes, the component is now replaced with the loaded component.
I dont know if anyone would find this useful since this has already been answered. I just felt like posting my own trick.
You can start a thread in which you do your stuff of getting data and all and in the UI thread show the loading dialog and then dispose that loading dialog once you are done with your services call.

using BeginReceivingRemoteControlEvents in Monotouch

I've made my app play music in the background, I also successfully made it become the media player by calling BeginReceivingRemoteControlEvents. however, the RemoteControlReceived method never gets called. the same logic in Objective C is working fine. Any samples or guidelines appreciated.
You need to ensure it is placed on the First responder view, and if not, the event needs to be passed up along the chain of responders until it reaches your remote events. Try to imagine remote control events the same as keypresses on the keyboard. For example, If the app is focused on a button, and you press some keyboard keys, nothing will happen, as a button isn't listening for key presses.
A similar situation is occurring in your code. Try to create a basic, single viewed project with the BeginReceivingRemoteControlEvents and the method override to receive the event (cant remember what it is, RemoteEventReceived() or something similar.) This should get fired when you press a remote button.
(sorry I cant give sample code, not in front of mac at the minute)
You might want to try using a later mechanism to listen for remote control events. For example, if you want to listen to the headset button:
MPRemoteCommandCenter *commandCenter = [MPRemoteCommandCenter sharedCommandCenter];
[commandCenter.togglePlayPauseCommand addTargetWithHandler:^MPRemoteCommandHandlerStatus(MPRemoteCommandEvent * _Nonnull event) {
NSLog(#"toggle button pressed");
return MPRemoteCommandHandlerStatusSuccess;
}];
or, if you prefer to use a method instead of a block:
[commandCenter.togglePlayPauseCommand addTarget:self action:#selector(toggleButtonAction)];
To stop:
[commandCenter.togglePlayPauseCommand removeTarget:self];
or:
[commandCenter.togglePlayPauseCommand removeTarget:self action:#selector(toggleButtonAction)];
You'll need to add this to the includes area of your file:
#import MediaPlayer;
This works in the background, ONLY if you are an audio app playing in the background (i.e. you have to set that background mode in your app capabilities).

Blackberry application hangs and freezes on UI modification

I've written a Blackberry appliation with the Blackberry JDE, running on a 9000 simulator. I tested it a week or so ago and loaded it on a Blackberry 9000 phone, and everything worked just fine. Sometime between then and now, though, something went wrong.
My code does the whole moving arrow "loading things from the internet" or whatever thing, but no screens pop up. My original screen, which is just a MainScreen with a RichTextField doesn't load at all. This screen, at least, has most likely not changed in the passing week, so if something broke, it would be in one of the later screens/lines of code that it shouldn't even be getting to yet!
Is it possible that my .jad or .cod file are corrupted somehow? I noticed that when I first put code on my machine, I just stuck in the .cod file that Eclipse provided me. Then, last week, the .cod file it gave me didn't work, because it was ACTUALLY a zip file with a two .cod files inside of it. Using the .cod file with the same name as the .cod file they were in succesfully loaded my app. I did the same this time, and I don't get invalid cod file errors or anything, but the app is still as broken.
Is there some direction I should be looking? Is the issue likely to be in my code, the cod file, the phone, or somewhere completely else?
-Jenny
Edit: I've narrowed it down to the problem only occuring if I attempt to load a particular screen. My problem is that this screen is nearly identical to another screen that IS working just fine on the actual device. Both screens are generated from the same method (which makes a webservice call and gets XML back and parses it to populate the fields of the screen). The only difference is that the screen that is breaking is going to a different URL. This URL DOES work (both from a browser and from the simulated device), so I"m at a loss. The application doesn't seem to crash, (it's still running in the background), it just doesn't attempt to display anymore.
Edit:
Okay, I'm seeing some tunneling errors immediately after I load my app, (but before I execute any of my networking code). When i do execute my networking code, it works just fine, unless it happens to be for my "Rental" section. I commented out all calls to that, and made my menu item for Rentals simply make a print statement. The code behaves identically (it freezes, or displays a white screen after selecting the button). All other menu items work (including those that call threads or network methods). And the rentals menu sucessfully executes in the simulator.
private MenuItem _rentals = new MenuItem("My Rentals", 110,
10) {
public void run() {
//if the last thing I did was a rental
//just show the screen
//else, reload rentals
System.out.println("Rentals was selected");
displayError("Rentals was pressed");
// if(rental){
// System.out.println("It's a rental!");
// popScreen(getActiveScreen());
// pushScreen(_offeringsScreen);
// }else{
// System.out.println("Getting Rentals from scratch");
// RentalsThread _rThread = new RentalsThread();
// _rThread.start();
// }
}};
I'm at a complete loss here: The device debugger doesn't seem to even register me selecting the menu item, and not a single line of code executes! It just freezes! I'll try putting back in my RentalsThread call in the start of my program (which was also freezing) just to see if I can tease apart the problem with the Rentals Thread (which makes the Rental Screen), and the problem with the Rentals menu item.
Okay, I think I have this figured out.
1.) My code was still behaving identically even after commenting out everything because I wasn't rebuilding the .COD files (they automatically rebuild if you try to run it in the simulator, but don't when you're generating a .ALX file, for some reason).
2.) The code I had for generating the Rental Screen was adding things to said screen. Apparently this is all well and good on the simulator, but on the real device it's required that you do all graphics manipulation (even for graphics not yet displayed) in an event thread (I used invokeAndWait).
So, now everything seems to be working just fine. There wasn't anything wrong with my networking (nor did I think there was, because my other networking screen works just fine). I still don't know why I get all those weird tunneling network things before I start, but it doesn't seem to affect anything yet.
See also:
BlackBerry UI Threading - The Very Basics
BlackBerry threading model
several suggestions:
if you have some background work with resources like file IO or networking, app just may stuck there... provide error handling and try to debug app from device!
code signing, check latest code update for API which require signing. But since there are no errors this is doubtful.
To debug on device, run Blackberry Device Manager, attach phone to usb, in eclipse select project, Context Menu -> Debug As -> Blackberry Device.
See A50 How to Debug and Optimize
UPDATE I see "Tunnel failed" exception, so it's like network connection problem...
See tunnel failed in blackberry bold. why?
How to Configure Full Internet Access On BlackBerry
UPDATE Support - Application stops responding when opening a connection

Resources