Mediaplayer.play method taking time - windows-phone-7

We are developing a XNA game with high interactivity. The game includes some background music.
We are trying to play the background music through the MEdiaplayer.play method. But this seems to block the smooth gameplay for a while. How can this be overcome?
Had tried using the soundeffect instance for this initially and it worked fine. But that approach doesn't seem to go well with the certification requirements. Pls help
Thank You

I think this is normal for large music files. You could however try to put
IsFixedTimeStep = false;
after
TargetElapsedTime = TimeSpan.FromTicks(???);
I have found that that makes a smoother gamepay. At least back in 7.0 - but I still use it.
I of course assume that you use elapsed time for all animations.

Related

HTML5 Fullscreen API & performance

I'm coding an app around video content and am currently playing around with HTML5's fullscreen API (I know it is still in very early stage).
Because of what my application does, the video itself isn't the only part that goes fullscreen: several elements alongside go fullscreen too, and I have noticed a great drop in performance there. The video streams ok, but other graphical elements suddenly get painfully slow. For example, a hover style typically takes about a good half second before showing up. A simple change in subtitles (I use popcorn.js) causes the video to freeze for a fraction of a second.
Any one knows why this is so? Do you experience the same? Thanks for your precious feedback.

How to improve rendering performance with multiple equal and heavy movieclips?

I have 25 kind of heavy movieclips on the screen. They show many bitmaps, each one of in one of their frames. The problem is that the application gets unusable when they are on screen. And even after removing them the app keeps slow.
Using Adobe Air 2.0, compiled by Flash CS5.
There literally thousands of optimization tricks for Flash, but one that usually helps when dealing with large (or complex) Sprites or MovieClips is the cacheAsBitmap property:
my_mc.cacheAsBitmap = true;
And since you are using Adobe Air, you can also have access to the cacheAsBitmapMatrix property, for further optimization (badly needed on mobile devices!):
my_mc.cacheAsBitmapMatrix= my_mc.transform.concatenatedMatrix;
my_mc.cacheAsBitmap = true; //also this!
Check out this Republic of Code tutorial about when/why better use them.
Hope this helps!

Custom SLider for video on iPad

I have a custom UISlider and use the currentPlaybackTime to change values of an MPMoviePlayerController object.
The problem is when i scrub at a fast rate using the slider, it doesn't respond as fast as i would like..
Is there any better way to have a fast interactive scrubber for ipad? targeting from OS 3.2
Well there are two issues, only one you can control directly.
Multimedia-content is commonly compressed using some kind of delta-compression, hence quick and exact seeking is not a trivial task to cope with. As that is common and since you can not directly change that, you will have to live with it.
the only way to increase responsiveness for seeking on the content-side (when encoding) is reducing the gop-size - that is, less p-frames between the i-frames.
when using a slider or a similar control, you could, instead of directly connecting the current playback position with it, handle any manual changes in an indirect fashion. You could run a timer based job that, whenever the slider/scrubber has been moved, tries to adjust the playback position towards that new value. Once the player is seeking, prevent the scrubber from getting feedback from the current playback location but allow it once the player is in playing state again. That way the user does not directly experience the clunky seek feedback.

how to create animation of sparkling effect for iphone using cocos2d or Quartz core

I am creating one application in that i want to give background effect like there are number of starts and something like we are in universe and some starts are getting lighted for few seconds then some other starts etc.
I got one open gles animation of Explosion , but I want that kind of effect using quartz core or Cocos2d so that I can implement other things easily.
if any one do have any idea or any sample for the sample please suggest me.
Thanks in advance
If I understand you question correctly (that is not quite clear) you can use some particle effect to simulate most of the "cosmic" lighting, starts, comets even galaxy.
Please have a look at http://www.cocos2d-iphone.org/archives/926 , it is particle tutorial

Qt Animation: Appearing & Disappearing Objects

I'm writing a video annotation application with Qt4 in which users need to be able to seek to various points in a video, putting markers on various objects and then setting keypoints for those markers so that they stay on the objects in the video as they move around. QGraphicsItemAnimation seems like a great place to start for these markers, however they need to be able to appear and disappear at specific times, which I can't figure out how to do with the QGraphicsItemAnimation. I could set the scale at 0 to make the objects disappear, but that seems like a pretty hacky solution, and I'm guessing that the paint engine would still waste cpu cycles trying to draw those invisible objects. Does anyone have a better solution than this? I'm using Qt 4.5.3 right now, but I'm willing to upgrade to 4.6 if it makes things easier. Thanks!!
It seems like the functionality you want of showing/hiding QGraphicsItem objects is beyond the scope of the simple "tweening" that the animation class performs. It is only for one object at a time, and any appearance or disappearance you have to write yourself.
You still might get some mileage out of QGraphicsItemAnimation (although the fact that it uses its own timer instead of being locked to the frame clock of your video is a little dodgy).
Neglecting "seeking" for a moment, there is a QTimeLine::finished() signal. If you let the end of an annotation's active animation timeline represent the point where you want it to disappear, you can trigger QGraphicsItem::hide() at that point. When it comes time to turn it back on, you would construct a new QGraphicsItemAnimation (based on the next run of keyframe data for that object) and call QGraphicsItem::show().
Note that one of the headlining features of Qt 4.6 is the QtAnimation framework, which is more sophisticated but also rather complex. I've not used it yet, but looking over the examples it seems like you might be able to "animate" a visibility or opacity property.

Resources