Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ru.timuruktus.fun;
- import android.app.Activity;
- import android.media.MediaPlayer;
- import android.os.Bundle;
- import android.os.Environment;
- import android.util.Log;
- import android.view.SurfaceHolder;
- import android.view.SurfaceView;
- import android.view.View;
- import java.io.File;
- import java.io.FileDescriptor;
- import java.io.FileInputStream;
- import java.io.IOException;
- import java.net.URL;
- public class MainActivity extends Activity implements View.OnClickListener {
- final String LOG_TAG = "myLogs";
- SurfaceView videoView;
- SurfaceHolder surfaceHolder;
- DataBaseActions DBA;
- public static final int LOAD_CITIES = 1;
- MediaPlayer mp;
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- DBA = new DataBaseActions(LOAD_CITIES);
- videoView = (SurfaceView) findViewById(R.id.videoView);
- mp = new MediaPlayer();
- mp.reset();
- try {
- File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
- File file = new File(path, "490527.mp4");
- mp.setDataSource(file.toString());
- mp.prepare();
- surfaceHolder = videoView.getHolder();
- mp.setDisplay(surfaceHolder);
- } catch (Exception ex) {
- Log.d(LOG_TAG, "Error in reading the welcome file");
- ex.printStackTrace();
- }
- mp.setLooping(true);
- mp.start();
- }
- @Override
- public void onClick(View v) {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement