Bonjour,
Je veux lire une vidéo 3D dans mon application mais celle-ci prend automatiquement toute la largeur de l'écran alors que je veux garder la taille d'origine dans mon cas.

Voici mon layout
Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >
 
    <FrameLayout
        android:id="@+id/media_content"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_gravity="center"
        android:background="@color/red"
        android:keepScreenOn="true" >
<!-- ProgressBar remplacée par un SurfaceView/ImageView/VideoView en fonction du besoin -->
        <ProgressBar
            android:id="@+id/waiting"
            style="?android:attr/progressBarStyleLarge"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center" />
    </FrameLayout>
 
    <LinearLayout
        android:id="@+id/vote_window"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:background="@android:color/transparent"
        android:orientation="horizontal" >
<!-- Fenêtre qui s'affiche quand besoin -->
    </LinearLayout>
</merge>

Un bout de code de mon activité :
Code java : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		mContext = getApplicationContext();
		setContentView(R.layout.evaluation);
		//...
		if (session.evaluation.mode.equals("3D")) {
			mPreview = new SurfaceView(mContext);
			lp_media = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
			mPreview.setLayoutParams(lp_media);
			holder = mPreview.getHolder();
			mReal3D = new Real3D(holder);
			holder.addCallback(this);
			holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
			//holder.setSizeFromLayout();
			mReal3D.setReal3DInfo(new Real3DInfo(true, Real3D.REAL3D_TYPE_SS, Real3D.REAL3D_ORDER_LR));
			v_content.addView(mPreview);
		} else {
			if (session.evaluation.type.equals("image")) {
				b_play.setImageResource(android.R.drawable.ic_menu_search);
				mImage = new ImageView(mContext);
				v_content.addView(mImage);
			} else {
				mVideo = new VideoView(mContext);
				v_content.addView(mVideo);
			}
		}
 
	}
	public void initVideoPlayer() {
		try {
			File f = new File(Environment.getExternalStorageDirectory(), "Evaluations/media/" + session.evaluation.media.get(currentMedia-1).file);
			//android.util.Log.i(TAG, f.getAbsolutePath());
			mMediaPlayer = new MediaPlayer();
			mMediaPlayer.setDataSource(f.getPath());
			mMediaPlayer.setDisplay(holder);
			mMediaPlayer.setLooping(false);
			mMediaPlayer.setVolume(0, 0);
			mMediaPlayer.prepare();
			//mMediaPlayer.prepareAsync();
			mMediaPlayer.setOnBufferingUpdateListener(this);
			mMediaPlayer.setOnCompletionListener(this);
			mMediaPlayer.setOnPreparedListener(this);
			mMediaPlayer.setOnVideoSizeChangedListener(this);
			mMediaPlayer.setAudioStreamType(android.media.AudioManager.STREAM_MUSIC);
		} catch (Exception e) {
			//android.util.Log.e(TAG, "Cannot init 3D video player");
			e.printStackTrace();
		}
	}
 
    public void onPrepared(MediaPlayer mediaplayer) {
    	//android.util.Log.d(TAG, "onPrepared called");
        mIsVideoReadyToBePlayed = true;
        Real3DInfo info = mReal3D.getReal3DInfo();
        if (info != null) {
        	//android.util.Log.d(TAG, "Real3D info :" + info.disableAutoDetection + " " + info.type + " " + info.order);
        }
        mVideoHeight=mMediaPlayer.getVideoHeight();
		mVideoWidth=mMediaPlayer.getVideoWidth();
		//j'ai fait des essais ici pour la taille mais ca crash
		//lp_media = new LayoutParams(mVideoWidth, mVideoHeight);
		//mPreview.setLayoutParams(lp_media); //FIXME
		//android.util.Log.i(TAG, "Video size: "+ mVideoWidth+"x"+mVideoHeight);
        if (mIsVideoReadyToBePlayed && mIsVideoSizeKnown) startVideoPlayback();
    }
    public void surfaceChanged(SurfaceHolder surfaceholder, int i, int j, int k) { }
 
    public void surfaceDestroyed(SurfaceHolder surfaceholder) { }
 
    /** 
     * Call when the surface to display the video is ready
     */
    public void surfaceCreated(SurfaceHolder holder) {
    	//android.util.Log.i(TAG, "Surface created");
    	initVideoPlayer();
    }

Avez vous des piste ou une solution ?
Merci d'avance