我有j2me應用程序在其中播放視頻。在客戶端設備上,它會旋轉到相反的方向。指定j2me上的視頻旋轉方向
我想知道的是,是否有任何方法可用於LWUIT中的視頻旋轉(指定旋轉方向),因此根據我們的應用程序,我們可以將視頻旋轉到所需的方向?
我有j2me應用程序在其中播放視頻。在客戶端設備上,它會旋轉到相反的方向。指定j2me上的視頻旋轉方向
我想知道的是,是否有任何方法可用於LWUIT中的視頻旋轉(指定旋轉方向),因此根據我們的應用程序,我們可以將視頻旋轉到所需的方向?
我的理解 http://i48.tinypic.com/vn08ye.png
http://i49.tinypic.com/w2fz0i.png
在這裏,您可以旋轉在索尼愛立信JP-7或更高版本的視頻,只要是代碼片段我用:
//boolean rotate90 indicates whether we want to rotate it
private void setDisplay(boolean init) {
if(videoControl == null) return;
boolean rotate = false;
trans = Sprite.TRANS_NONE;
if (rotate90) {
rotate = true;
trans = Sprite.TRANS_ROT90;
}
if (init) {
try {
// video rotate
videoControl.initDisplayMode(VideoControl.USE_DIRECT_VIDEO | (trans << 4), this);
} catch (Throwable e) { // not supported by device
// direct video
trans = Sprite.TRANS_NONE;
videoControl.initDisplayMode(VideoControl.USE_DIRECT_VIDEO, this);
}
}
videoControl.setVisible(false);
int dw, dh;
//set up target width (dw), and target height (dh) as desired...
//...
//...
try {
videoControl.setDisplaySize(dw, dh);
}
catch(Throwable e) {
//...
}
videoControl.setVisible(true);
}
// rotate during playback
private void rotateVideo() {
// if we dont't have it, reinit video with new rotation and set current media time
if (!Main.classExists("com.sonyericsson.media.control.DisplayModeControl")) replayVideo();
else {
setDisplay(false); // resize our picture, no init
// rotate the video.
com.sonyericsson.media.control.DisplayModeControl dmc = (com.sonyericsson.media.control.DisplayModeControl)player.getControl("com.sonyericsson.media.control.DisplayModeControl");
dmc.setDisplayMode(rotate90 ? (Sprite.TRANS_ROT90 << 4) : (Sprite.TRANS_NONE << 4));
dmc = null;
}
}
private void replayVideo() {
long prevtime = player.getMediaTime();
play(); //reopen file, Manager.createPlayer, setDIsplay(true), etc.
try {
playerPause();
player.setMediaTime(prevtime);
playerStart();
}
catch(MediaException me) { }
}
嗨,我使用LWUIT框架來實現UI。所以Sprite並沒有用到那裏。所以這段代碼在我的應用程序中並沒有用 – Megha 2012-05-15 16:05:43
沒有得到你的問題正確@Megha – Lucifer 2012-03-17 10:14:11
想旋轉視頻怎麼做? – Megha 2012-03-17 10:29:29
一個可以理解的問題提供了更好的答案! – 2012-03-20 06:24:12