コード例 #1
0
 /**
  * 加载并开始播放视频
  *
  * @param videoUrl videoUrl
  */
 private void loadAndPlay(VideoUrl videoUrl, int seekTime) {
   showProgressView(seekTime > 0);
   setCloseButton(true);
   if (TextUtils.isEmpty(videoUrl.getFormatUrl())) {
     Log.e("TAG", "videoUrl should not be null");
     return;
   }
   mSuperVideoView.setOnPreparedListener(mOnPreparedListener);
   if (videoUrl.isOnlineVideo()) {
     mSuperVideoView.setVideoPath(videoUrl.getFormatUrl());
   } else {
     Uri uri = Uri.parse(videoUrl.getFormatUrl());
     mSuperVideoView.setVideoURI(uri);
   }
   mSuperVideoView.setVisibility(VISIBLE);
   startPlayVideo(seekTime);
 }
コード例 #2
0
  /**
   * * 播放本地视频 只支持横屏播放
   *
   * @param fileUrl fileUrl
   */
  @SuppressWarnings("unused")
  public void loadLocalVideo(String fileUrl) {
    VideoUrl videoUrl = new VideoUrl();
    videoUrl.setIsOnlineVideo(false);
    videoUrl.setFormatUrl(fileUrl);
    videoUrl.setFormatName("本地视频");
    Video video = new Video();
    ArrayList<VideoUrl> videoUrls = new ArrayList<>();
    videoUrls.add(videoUrl);
    video.setVideoUrl(videoUrls);
    video.setPlayUrl(0);

    mNowPlayVideo = video;

    /** * 初始化控制条的精简模式 */
    mMediaController.initTrimmedMode();
    loadAndPlay(mNowPlayVideo.getPlayUrl(), 0);
  }