Ejemplo n.º 1
0
 /**
  * Sets <code>url</code> to object of <code>VideoView</code> class (that is in fild of
  * VideoActivity) and starts it.
  *
  * @param uri is string that contains URL
  */
 private void startVideo(Uri uri) {
   Log.i("SetVideo url here:", "url:" + uri.toString());
   if (uri.toString().matches(StringsStore.URL_PATTERN) || uri.toString().contains("file://")) {
     this.__uri = uri;
     videoView.setVideoURI(uri);
     videoView.requestFocus();
     videoView.start();
   } else if (uri.toString().matches(StringsStore.URL_PATTERN)) {
     videoView.setVideoURI(uri);
     videoView.requestFocus();
     videoView.start();
   }
 }
Ejemplo n.º 2
0
  private void loadVideo() {
    getWindow().setFormat(PixelFormat.TRANSLUCENT);
    mVideoView = (VideoView) findViewById(R.id.imageViewCenter);
    mVideoView.setMediaController(new MediaController(this));
    Uri video = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.water_drop);
    mVideoView.setVideoURI(video);
    mVideoView.start();

    if (isLEFT) {

      lp.setMargins(1200, 0, -1000, 0);
      mThumbnailTopLayout.setVisibility(View.GONE);
      mThumnailBottomLayout.setVisibility(View.GONE);

    } else {
      lp.setMargins(-640, 0, 640, 0);
    }
    mVideoView.setLayoutParams(lp);

    mVideoView.setClickable(true);
    mVideoView.setOnTouchListener(
        new OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            // System.out.println(mVideoView);
            // mVideoView.stopPlayback();
            lp.setMargins(0, 0, 0, 0);
            mVideoView.setLayoutParams(lp);
            return true;
          }
        });
  }
Ejemplo n.º 3
0
 /*private String getSDPath(){
     File sdDir = null;
     boolean sdCardExist = Environment.getExternalStorageState()
                         .equals(android.os.Environment.MEDIA_MOUNTED);
     if(sdCardExist){
           //��ȡ��Ŀ¼
       sdDir = Environment.getExternalStorageDirectory();
     }
     return sdDir.toString();
 } */
 protected void onResume() {
   super.onResume();
   vv = (VideoView) findViewById(R.id.vv_q1_tg_m_sax);
   vv.setVideoURI(Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.tg_m_sax));
   //        vv.setOnCompletionListener(onCompListener);
   vv.start();
 }
Ejemplo n.º 4
0
  /**
   * Called on Activity creation. set the background and video, media player and completion listener
   *
   * @param savedInstanceState
   */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    this.getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    // TODO: redo the travel video and include audio in it as well.

    setContentView(R.layout.travel);

    travel = (VideoView) findViewById(R.id.travel_background);

    travel.setOnTouchListener(this);
    Uri video = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.travel);

    travel.setOnCompletionListener(this);

    travel.setVideoURI(video);

    travel.start();
  }
Ejemplo n.º 5
0
  private void initViews() {

    tvTitle = (TextView) findViewById(R.id.tvTitle);
    tvTitle.setText(mNote.getTitle());

    tvViewCategory = (TextView) findViewById(R.id.tvViewCategory);
    tvViewCategory.setText(mNote.getCategory());

    tvContent = (TextView) findViewById(R.id.tvContent);
    tvContent.setText(mNote.getContent());

    ivShowPhoto = (ImageView) findViewById(R.id.ivShowPhoto);
    String imagePath = mNote.getImagePath();
    if (!TextUtils.isEmpty(imagePath)) {
      BitmapUtils bitmapUtils = new BitmapUtils(this);
      bitmapUtils.display(ivShowPhoto, imagePath);
      ivShowPhoto.setVisibility(View.VISIBLE);
    }

    vvViewVideo = (VideoView) findViewById(R.id.vvViewVideo);
    String videoPath = mNote.getVideoPath();
    if (!TextUtils.isEmpty(videoPath)) {
      vvViewVideo.setVideoURI(Uri.parse(videoPath));
      vvViewVideo.setVisibility(View.VISIBLE);
      if (!vvViewVideo.isPlaying()) {
        vvViewVideo.start();
      }
    }
  }
 private void handleCameraVideo(Intent intent) {
   mVideoUri = intent.getData();
   mVideoView.setVideoURI(mVideoUri);
   mImageBitmap = null;
   mVideoView.setVisibility(View.VISIBLE);
   mImageView.setVisibility(View.INVISIBLE);
 }
Ejemplo n.º 7
0
  public void showVideo(String advice) {
    VideoView video = new VideoView(this);
    video.setVideoURI(Uri.parse(advice));
    ViewGroup.LayoutParams params =
        new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    video.setLayoutParams(params);

    MediaController controller =
        new MediaController(this) {
          @Override
          public void hide() {}

          @Override
          public boolean dispatchKeyEvent(KeyEvent event) {
            if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) finish();
            return super.dispatchKeyEvent(event);
          }
        };
    controller.setAnchorView(video);
    video.setMediaController(controller);

    layout.addView(video);
    video.start();
  }
Ejemplo n.º 8
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    this.setContentView(R.layout.q1_tg_m_sax);

    vv = (VideoView) findViewById(R.id.vv_q1_tg_m_sax);
    vv.setVideoURI(Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.tg_m_sax));

    //		vv.setOnCompletionListener(onCompListener);
    vv.start();

    ib = (ImageButton) findViewById(R.id.tg_m_sax_btn);
    ib.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            Intent intent = new Intent(TG_M_SaxActivity.this, Section686Activity.class);
            Bundle bundle = new Bundle();
            bundle.putInt("sec", 3);
            intent.putExtras(bundle);
            startActivity(intent);
            overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right);
          }
        });
  }
Ejemplo n.º 9
0
  // useVideoPlayerメソッド(VideoPlayerクラスを使用した動画再生処理)
  private void useVideoPlayer() {
    VideoView vvPlayer = (VideoView) findViewById(R.id.vv_player);

    // 動画のURIを取得
    String urlString =
        getIntent().getStringExtra(PlaytubeSampleActivity.IntentKey.MEDIA_URL.name());

    // 動画のURIを設定
    vvPlayer.setVideoURI(Uri.parse(urlString));

    // 動画タイトルを取得
    String title = getIntent().getStringExtra(PlaytubeSampleActivity.IntentKey.MEDIA_TITLE.name());

    // 動画再生元リスト判定
    flag =
        getIntent()
            .getIntExtra(PlaytubeSampleActivity.IntentKey.FROM_FLAG.name(), FROM_RESULTS_LIST);

    // タイトルバーに動画タイトルを設定
    setTitle(title);

    // メディアコントローラを設定
    vvPlayer.setMediaController(new MediaController(this));

    // 動画を再生
    vvPlayer.start();
  }
Ejemplo n.º 10
0
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   if (requestCode == VIEW_REQUEST_CODE && resultCode == RESULT_OK) {
     //            Note note = (Note) data.getSerializableExtra("request_note");
     mNote = (Note) data.getSerializableExtra("request_note");
     tvTitle.setText(mNote.getTitle());
     tvContent.setText(mNote.getContent());
     tvViewCategory.setText(mNote.getCategory());
     String imagePath = mNote.getImagePath();
     //            System.out.println("imagePath: " + imagePath);
     if (!TextUtils.isEmpty(imagePath)) {
       BitmapUtils bitmapUtils = new BitmapUtils(this);
       bitmapUtils.display(ivShowPhoto, imagePath);
       ivShowPhoto.setVisibility(View.VISIBLE);
     }
     String videoPath = mNote.getVideoPath();
     if (!TextUtils.isEmpty(videoPath)) {
       vvViewVideo.setVideoURI(Uri.parse(videoPath));
       vvViewVideo.setVisibility(View.VISIBLE);
       if (!vvViewVideo.isPlaying()) {
         vvViewVideo.start();
       }
     }
   }
 }
  @Override
  public View onCreateView(
      LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fr_less_15_c, container, false);

    ImageButton button = (ImageButton) view.findViewById(R.id.playVideo);

    videoView = (VideoView) view.findViewById(R.id.less_15_c);
    MediaController mController = new MediaController(getActivity());
    mController.setAnchorView(videoView);
    Uri videoUri =
        Uri.parse("android.resource://com.example.dell.learnerintermediate/raw/less_15_c");
    videoView.setMediaController(mController);
    videoView.setVideoURI(videoUri);

    button.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {

            videoView.start();
          }
        });
    return view;
  }
Ejemplo n.º 12
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_screen);

    // Play video in the background on the title screen.
    videoView = (VideoView) findViewById(R.id.VideoView);
    String uri = "android.resource://" + getPackageName() + "/" + R.drawable.dock;
    videoView.setVideoURI(Uri.parse(uri));
    videoView.setOnPreparedListener(
        new MediaPlayer.OnPreparedListener() {
          @Override
          public void onPrepared(MediaPlayer mp) {
            mp.setLooping(true);
          }
        });
    videoView.start();

    // Open login screen.
    signin = (Button) findViewById(R.id.signin);
    signin.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Intent intent = new Intent(RingToTitleScreen.this, RingToLogin.class);
            startActivity(intent);
          }
        });
  }
Ejemplo n.º 13
0
 private void openVideo() {
   if (progress != null) {
     progress.setVisibility(View.VISIBLE);
   }
   videoView.stopPlayback();
   final Uri uri = getArguments().<Uri>getParcelable(EXTRA_SOURCE_URI);
   videoView.setVideoURI(uri);
 }
Ejemplo n.º 14
0
  private void initVideoView() {
    mVideoView.setMediaController(new MediaController(this));
    Uri uri = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.bigbuck);
    mVideoView.setVideoURI(uri);

    setVideoViewPosition();
    mVideoView.start();
  }
 private void initializeVideo() {
   // Displays a video file.
   String uriPath = "android.resource://com.smartie.shrikant.smartie/" + R.raw.video5;
   Uri uri = Uri.parse(uriPath);
   mVideoView.setVideoURI(uri);
   mVideoView.requestFocus();
   mVideoView.start();
   mystartListen();
 }
Ejemplo n.º 16
0
 @Override
 protected void initData() {
   Uri uri = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.myfirstvideo);
   if (uri == null) {
     return;
   }
   videoView.setVideoURI(uri);
   videoView.start();
 }
Ejemplo n.º 17
0
 @Override
 protected void onResume() {
   // TODO Auto-generated method stub
   super.onResume();
   vv = (VideoView) findViewById(R.id.vv_q2_me_lax);
   vv.setVideoURI(Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.q2_me_lax));
   vv.setOnCompletionListener(onCompListener);
   vv.start();
 }
Ejemplo n.º 18
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.video_layout);

    VideoView video = (VideoView) findViewById(R.id.videoView1);
    video.setVideoURI(Uri.parse(videoPath));
    video.start();
  }
Ejemplo n.º 19
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.preview_video);

    mUri = Uri.fromFile(ItemList.currFile);
    mVideo = (VideoView) findViewById(R.id.previewvid);
    mVideo.setVideoURI(mUri);
    mVideo.start();
  }
 void syncVideo() {
   VideoView view = (VideoView) findViewById(R.id.videoView1);
   Time time = new Time();
   time.setToNow();
   current = time.hour / 6;
   int offset = ((time.hour % 6) * 3600000) + (time.minute * 60000) + (time.second * 1000);
   view.setVideoURI(uris.get(current));
   view.seekTo(offset);
   view.start();
 }
Ejemplo n.º 21
0
  public void playVideo(String urlCancion) {
    LinearLayout layout = (LinearLayout) findViewById(R.id.canciones_layout);
    layout.removeView(video);

    String urlCompleta = URL + "/" + urlCancion;
    video.setVideoURI(Uri.parse(urlCompleta));

    layout.addView(video);
    video.start();
  }
Ejemplo n.º 22
0
 private void prepareVideoEnd(int isSuccess) {
   if (isSuccess == 0) {
     hideLoading();
     mAfternoonImg.setImageBitmap(
         getVideoThumbnail(
             mTodayVideoPath, PhoneUtil.getPhoneWidth(), PhoneUtil.getPhoneHeight()));
     MediaController mediaController = new MediaController(this.getActivity());
     mAfternoonVideo.setMediaController(mediaController);
     mAfternoonVideo.setVideoURI(Uri.parse(mTodayVideoPath));
   }
 }
Ejemplo n.º 23
0
  @Override
  public void onResume() {
    super.onResume();

    VideoView videoView = (VideoView) findViewById(R.id.surface_view);
    Uri path = Uri.parse("android.resource://mx.com.cencel.comercial.cencel/" + R.raw.cencel_cam);

    videoView.setVideoURI(path);

    videoView.start();
  }
 @Override
 protected void onResume() {
   super.onResume();
   if (state_onpause == true) {
     VideoPlayer.setVideoURI(Uri.parse(videoURL));
     VideoPlayer.requestFocus();
     VideoPlayer.seekTo(seekPosition);
     VideoPlayer.start();
     state_onpause = false;
   }
 }
Ejemplo n.º 25
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_video2);

    VideoView videoView = (VideoView) this.findViewById(R.id.videoView2);
    videoView.setVideoURI(
        Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.most_important_decision));
    videoView.setMediaController(new MediaController(this));
    videoView.requestFocus();
    videoView.start();
  }
Ejemplo n.º 26
0
 public View onCreateView(
     LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
   View view = inflater.inflate(R.layout.fragment_video, container, false);
   VideoView videoView = (VideoView) view.findViewById(R.id.videoView);
   Carro c = getArguments().getParcelable("carro");
   if (c != null) {
     videoView.setVideoURI(Uri.parse(c.urlVideo));
     videoView.setMediaController(new MediaController(getContext()));
     videoView.start();
     toast("start: " + c.urlVideo);
   }
   return view;
 }
Ejemplo n.º 27
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.video_alert_dialog);
    ok = (Button) findViewById(R.id.btn_ok_video);
    MediaController mediaController = new MediaController(getContext());
    Log.i("Video Uri", url.toString());
    vv = (VideoView) findViewById(R.id.vid_dialog);
    mediaController.setAnchorView(vv);
    vv.setVideoURI(url);

    vv.start();
    ok.setOnClickListener(this);
  }
Ejemplo n.º 28
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.penampil_video);

    videoView = (VideoView) findViewById(R.id.VideoView);
    mediaController = new MediaController(this);
    mediaController.setAnchorView(videoView);
    Uri uri = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.tahap1);
    videoView.setMediaController(mediaController);
    videoView.setVideoURI(uri);
    videoView.requestFocus();
    videoView.start();
  }
 @Override
 protected void onRestoreInstanceState(Bundle savedInstanceState) {
   super.onRestoreInstanceState(savedInstanceState);
   mImageBitmap = savedInstanceState.getParcelable(BITMAP_STORAGE_KEY);
   mVideoUri = savedInstanceState.getParcelable(VIDEO_STORAGE_KEY);
   mImageView.setImageBitmap(mImageBitmap);
   mImageView.setVisibility(
       savedInstanceState.getBoolean(IMAGEVIEW_VISIBILITY_STORAGE_KEY)
           ? ImageView.VISIBLE
           : ImageView.INVISIBLE);
   mVideoView.setVideoURI(mVideoUri);
   mVideoView.setVisibility(
       savedInstanceState.getBoolean(VIDEOVIEW_VISIBILITY_STORAGE_KEY)
           ? ImageView.VISIBLE
           : ImageView.INVISIBLE);
 }
Ejemplo n.º 30
0
  public void setVideo(String name, Uri video) {
    if (mVideoView == null) {
      mVideoView = new VideoView(mContext);
      addView(
          mVideoView, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 0, 0));
      if (DEBUG) {
        mVideoView.setBackgroundColor(0xFFFF0000);
      }
    }

    if (LOCAL_LOGV) {
      Log.v(TAG, "Changing video source to " + video);
    }
    mVideoView.setVisibility(View.VISIBLE);
    mVideoView.setVideoURI(video);
  }