2012-03-17 46 views
1

我有j2me應用程序在其中播放視頻。在客戶端設備上,它會旋轉到相反的方向。指定j2me上的視頻旋轉方向

我想知道的是,是否有任何方法可用於LWUIT中的視頻旋轉(指定旋轉方向),因此根據我們的應用程序,我們可以將視頻旋轉到所需的方向?

+0

沒有得到你的問題正確@Megha – Lucifer 2012-03-17 10:14:11

+0

想旋轉視頻怎麼做? – Megha 2012-03-17 10:29:29

+1

一個可以理解的問題提供了更好的答案! – 2012-03-20 06:24:12

回答

1

據我所知你不能這樣做,但你可以看看高級MMAPI規範(JSR 234),它可能有一些東西。

+1

_高級MMAPI規範_你的意思是[JSR 234 AMMS](http://www.jcp.org/en/jsr/detail?id=234)? – gnat 2012-03-19 14:44:08

+0

是的,這就是我的意思。 – 2012-03-21 16:07:33

+0

這可以通過使用旋轉後的內容來實現,並給出顯示大小減1的大小。因此,視頻以正確的方向播放。 – Megha 2012-04-06 09:25:38

1

我的理解 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) { } 
    } 
+0

嗨,我使用LWUIT框架來實現UI。所以Sprite並沒有用到那裏。所以這段代碼在我的應用程序中並沒有用 – Megha 2012-05-15 16:05:43