package com.videonext;
import android.app.Activity;
import android.os.Bundle;
import android.view.*;
import android.widget.LinearLayout;
import android.content.Context;
import android.graphics.*;
import android.util.*;

public class Vn_mediaclient_testActivity extends Activity {
    
    MediaPlayer player = null;
    DrawPanel panel    = null;
    
	/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
      
        panel = new DrawPanel(this);
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(100, 100);
 		panel.setLayoutParams(layoutParams);

        setContentView(panel); 
        //setContentView(R.layout.main);
        setRequestedOrientation(6);
        

 		
        
        
        player = new MediaPlayer(panel);
        player.play("rtsp://192.168.0.197:8554/h264media?dev=280&transcode=1&dimensions=320x240&authorizationid=1");
    }
    
    public void onDestroy() {
        super.onDestroy();
        
        System.out.println("Stopping!!!!!!!!!!!");
        player.stop();
        
        //android.os.Process.killProcess(android.os.Process.myPid());
        
    }
    
    class DrawPanel extends View {
        public DrawPanel(Context context) {
            super(context);
        }
 
        @Override
        public void onDraw(Canvas canvas) {
            canvas.drawColor(Color.WHITE);
            player.paint(canvas, 240, 320, 240);
            
           
            
        }
    }

}