This page was last modified 06:04, 10 October 2007.
KIJ000761 - RTSP-streamed video has incorrect display size
From Forum Nokia Wiki
| ID | KIJ000761 | Creation date | October 10, 2007 |
| Platform | S60 3rd Edition, S60 3rd Edition, FP1 | Devices | Tested with Nokia N73, Nokia N80, Nokia N95, and Nokia E61i |
| Category | Java | Subcategory | Mobile Media API |
Description
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.
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.
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);
control.setVisible(true);
}
}
The attached example application can properly resize any video and play it centered on a Canvas.
StreamingTest_final_3rd_with_resize.zip
| Related Discussions | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| MP3 Streaming like real player... | senthilkumar05 | Mobile Java Media (Graphics & Sounds) | 6 | 2006-11-17 08:21 |
| RTSP stream, what is possible? | surferboy | Mobile Java Media (Graphics & Sounds) | 2 | 2007-04-19 11:47 |
| Playback streaming audio | DrBane | Symbian Media (Graphics & Sounds) | 7 | 2006-10-03 09:58 |
| S40 JSR 135 with RTSP Streaming | jgillioz | Graphics & Video & Streaming | 0 | 2006-09-20 12:27 |
| 3GP combatibility and size??? | kray | Graphics & Video & Streaming | 5 | 2007-09-14 18:24 |

