Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Archived:RTSP-streamed video has incorrect display size using Java ME on S60 3rd Edition (Known Issue)

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

Article Metadata
Code ExampleTested with
Devices(s): Tested with Nokia N73, Nokia N80, Nokia N95, and Nokia E61i
Platform(s): S60 3rd Edition, S60 3rd Edition, FP1
S60 3rd Edition FP1
S60 3rd Edition (initial release)
Created: User:Technical writer 1 (10 Oct 2007)
Last edited: hamishwillee (29 Jul 2013)


If the prefetch() method is called explicitly, video display size cannot be obtained early enough or at all from an RTSP stream. In this case a default size of 32*32 pixels is substituted for the source size. However, this does not affect the real stream anyway (for example, real stream dimensions are still the original), it is only that VideoControl.getSourceWidth() and getSourceHeight() return incorrect values.

Regardless of what VideoControl.getSourceWidth() and getSourceHeight() return, you can request the video to be shown in the original size or in any other size (for example, by calling VideoControl.setDisplaySize( 176, 144 )). This means that the preferable solution for this problem is to set the video display size to a predefined size, regardless of what getSourceWidth()/getSourceHeight() methods return.

If the prefetch() method is not called explicitly, the video will be displayed in the original size.

How to reproduce

See the attached applications for a reproduction of the problem.

  1. For video 1) option "Start no prefetch" displays the video in its original size, while "Start with prefetch" displays the video as a tiny 32x32 square.
  2. For video 2) both options work correctly. The behavior described above occurs only in some videos, not in all of them.

In order to overcome this problem, do not use the prefetch() method and do not resize the video using setDisplaySize(), and place the video in the center of the Canvas only after the player is started.

This can be achieved by implementing a PlayerListener and replacing the video location only when it is in the STARTED state. One example of the implementation is:

public void playerUpdate(Player p, String s, Object o) {
status = s;
if(p.getState() == Player.STARTED) {
int width = control.getDisplayWidth();
int height = control.getDisplayHeight();
control.setDisplayLocation((getWidth() - width)/2,(getHeight() - height)/2);

The attached example application can properly resize any video and play it centered on a Canvas: File:StreamingTest, File:StreamingTest final 3rd with

This page was last modified on 29 July 2013, at 11:00.
51 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.