当前位置: 首页>>代码示例>>Java>>正文


Java VideoView.setVideoURI方法代码示例

本文整理汇总了Java中android.widget.VideoView.setVideoURI方法的典型用法代码示例。如果您正苦于以下问题:Java VideoView.setVideoURI方法的具体用法?Java VideoView.setVideoURI怎么用?Java VideoView.setVideoURI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.VideoView的用法示例。


在下文中一共展示了VideoView.setVideoURI方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: go

import android.widget.VideoView; //导入方法依赖的package包/类
private void go() {
VideoView v=(VideoView)findViewById(R.id.videoView) ;
        final ProgressBar p=(ProgressBar)findViewById(R.id.progressBar3);
        v.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
            @Override
            public void onPrepared(MediaPlayer mp) {
                p.setVisibility(View.GONE);
            }
        });
        String s="https://firebasestorage.googleapis.com/v0/b/lifesaver-18f28.appspot.com/o/flood.mp4?alt=media&token=179d7e4e-7171-4a87-b1f8-b1fc3d976c60";
        Uri uri=Uri.parse(s);
        v.setVideoURI(uri);
        v.setVideoPath(s);
        v.requestFocus();
        v.start();


    }
 
开发者ID:iamjaspreetsingh,项目名称:LifeSaver,代码行数:19,代码来源:Main4Activity.java

示例2: go

import android.widget.VideoView; //导入方法依赖的package包/类
private void go() {
        final ProgressBar p=(ProgressBar)findViewById(R.id.progressBar2);
        VideoView v=(VideoView)findViewById(R.id.videoView2) ;
v.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
    @Override
    public void onPrepared(MediaPlayer mp) {
        p.setVisibility(View.GONE);
    }
});
String s="https://firebasestorage.googleapis.com/v0/b/lifesaver-18f28.appspot.com/o/earthquake.mp4?alt=media&token=98993371-823d-4b81-adc7-d9d87ec841a9";
        Uri uri=Uri.parse(s);
        v.setVideoURI(uri);
         v.setVisibility(View.VISIBLE);
         v.setVideoPath(s);
        v.requestFocus();
        v.start();





    }
 
开发者ID:iamjaspreetsingh,项目名称:LifeSaver,代码行数:23,代码来源:Main3Activity.java

示例3: onCreate

import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    String url = getIntent().getExtras().getString(Constants.URL);
    setContentView(R.layout.fragment_video_gallery);
    final VideoView videoView = (VideoView) findViewById(R.id.videoView);
    videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
        @Override
        public void onPrepared(MediaPlayer mp) {
            View progress = findViewById(R.id.videoProgress);
            progress.setVisibility(View.GONE);

            videoView.requestFocus();
            MediaController vidControl = new MediaController(VideoPlayerActivity.this);
            vidControl.setAnchorView(videoView);
            videoView.setMediaController(vidControl);
            videoView.start();
        }
    });
    videoView.setVideoURI(Uri.parse(url));
}
 
开发者ID:yangchong211,项目名称:YCGallery,代码行数:22,代码来源:VideoPlayerActivity.java

示例4: onCreate

import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.video_full);
    videofull=(VideoView)findViewById(R.id.videofull);
    videofull.setVideoURI(Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.video));
    videofull.setMediaController(new MediaController(VideoFull.this));
    videofull.start();
    videofull.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
        @Override
        public void onPrepared(MediaPlayer mp) {
            mp.setLooping(true);
        }
    });
    videofull.requestFocus();
}
 
开发者ID:siddhantvinchurkar,项目名称:Marv,代码行数:17,代码来源:VideoFull.java

示例5: onCreate

import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    String url = getIntent().getExtras().getString(Constants.URL);
    setContentView(R.layout.video_fragment);
    final VideoView videoView = (VideoView) findViewById(R.id.videoView);
    videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
        @Override
        public void onPrepared(MediaPlayer mp) {
            View progress = findViewById(R.id.videoProgress);
            progress.setVisibility(View.GONE);

            videoView.requestFocus();
            MediaController vidControl = new MediaController(VideoPlayerActivity.this);
            vidControl.setAnchorView(videoView);
            videoView.setMediaController(vidControl);
            videoView.start();
        }
    });
    videoView.setVideoURI(Uri.parse(url));
}
 
开发者ID:PM-Martin,项目名称:ScrollGallery-android,代码行数:22,代码来源:VideoPlayerActivity.java

示例6: onViewCreated

import android.widget.VideoView; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    adapter = new MyPagerAdapter(getChildFragmentManager());
    DexShiftingPagerLayout dexShiftingView = (DexShiftingPagerLayout) view.findViewById(R.id.dexshiftingview);
    dexShiftingView.setOnShiftListener(onShiftListener);
    dexShiftingView.setToolbar(onShiftListener.getToolbar(), getResources().getColor(R.color.primary), getResources().getColor(R.color.secondary));
    dexShiftingView.setAdapter(adapter);
    switch (subsection) {
        case VIDEO_VIEW:
            VideoView videoView = (VideoView) view.findViewById(R.id.video);
            videoView.setVideoURI(Uri.parse("android.resource://" + getActivity().getPackageName() + "/"
                    + R.raw.video));
            videoView.start();
            break;
    }
}
 
开发者ID:dexlex,项目名称:DexShiftingView,代码行数:18,代码来源:ContentPagerFragment.java

示例7: onCreate

import android.widget.VideoView; //导入方法依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        VideoView v = (VideoView) findViewById(R.id.videoView);
//        v.setVideoPath("/sdcard/video.mp4");
        v.setVideoURI(Uri.parse(String.format(
                "android.resource://%s/%s",
                getPackageName(),
                R.raw.video
        )));
        v.setMediaController(new MediaController(this));
        v.requestFocus();
        v.start();
    }
 
开发者ID:acelaya,项目名称:android-course,代码行数:17,代码来源:Main.java

示例8: onCreate

import android.widget.VideoView; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    //Get the ViewView 
    vv = (VideoView) this.findViewById( R.id.videoView);
    //add media controls to it.
    vv.setMediaController(new MediaController(this));
    //Setup where the file to play is
    
    //on the SDcard in the root directory.  Not you need permissions to read the external storage.
    //Uri videoUri = Uri.parse(Environment.getExternalStorageDirectory().getPath() + "/the-empire.3gp");
    //Log.v("path",Environment.getExternalStorageDirectory().getPath() );
    
    //via the web.  Note you need Internet permissions.
    Uri videoUri = Uri.parse("http://www.cs.uwyo.edu/~seker/courses/4730/example/the-empire.3gp");
    vv.setVideoURI(videoUri);
    //play the video
    vv.start();

}
 
开发者ID:JimSeker,项目名称:AudioVideo,代码行数:22,代码来源:videoPlay.java

示例9: onCreateView

import android.widget.VideoView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View myView = inflater.inflate(R.layout.fragment_main, container, false);
    //Get the ViewView
    vv = (VideoView) myView.findViewById( R.id.videoView);
    //add media controls to it.  //note, in a fragment, this dies... don't know why.
    // in both frag and activity these are are wrong: getApplicationContext() and getBaseContext()
    //It's not context, actually needs the activity, so it can display the controls to the screen.
    vv.setMediaController(new MediaController(getActivity()));
    //Setup where the file to play is

    //on the SDcard in the root directory.  Now you need permissions to read the external storage.
    //Uri videoUri = Uri.parse(Environment.getExternalStorageDirectory().getPath() + "/the-empire.3gp");
    //Log.v("path",Environment.getExternalStorageDirectory().getPath() );

    //via the web.  Note you need Internet permissions.
    Uri videoUri = Uri.parse("http://www.cs.uwyo.edu/~seker/courses/4730/example/the-empire.3gp");
    vv.setVideoURI(videoUri);
    //play the video
    vv.start();
    return myView;
}
 
开发者ID:JimSeker,项目名称:AudioVideo,代码行数:25,代码来源:MainFragment.java

示例10: onCreate

import android.widget.VideoView; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    PreferencesState.getInstance().initalizateActivityDependencies();
    setContentView(R.layout.video_activity);

    //Displays a video file.
    MediaController mediaController = new MediaController(VideoActivity.this);
    mVideoView = (VideoView) findViewById(R.id.videoview);
    String videoPathParam = getIntent().getStringExtra(VIDEO_PATH_PARAM);
    File file = new File(videoPathParam);
    if (file.exists()) {
        mVideoView.setVideoPath(videoPathParam);
    } else {
        mVideoView.setVideoURI(FileIOUtils.getRawUri(videoPathParam));
    }
    mVideoView.setMediaController(mediaController);
    mediaController.setAnchorView(mVideoView);

    mVideoView.requestFocus();
    if (savedInstanceState != null) {
        mVideoView.seekTo(savedInstanceState.getInt("video", 0));
    }
    mVideoView.start();
}
 
开发者ID:EyeSeeTea,项目名称:malariapp,代码行数:26,代码来源:VideoActivity.java

示例11: onCreate

import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_video);

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    VideoView videoView = (VideoView) findViewById(R.id.video_view);
    final String uri = "android.resource://" + getPackageName() + "/" + R.raw.fix_429;
    videoView.setVideoURI(Uri.parse(uri));
    // Loop
    videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
        @Override
        public void onPrepared(MediaPlayer mp) {
            mp.setLooping(true);
        }
    });
    // Play
    videoView.start();
}
 
开发者ID:wequick,项目名称:Small,代码行数:21,代码来源:VideoActivity.java

示例12: onCreate

import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	mVideoContainer = new VideoContainer(this);
	this.setContentView(mVideoContainer);

	VideoView videoView = mVideoContainer.getVideoView();
	mExtra = new VideoExtra();
	if (mExtra.getFrom(getIntent())) {
		videoView.setVideoURI(Uri.parse(mExtra.mUrl));
		if (mExtra.mAutoPlay) {
			videoView.start();
		}
	}
	videoView.requestFocus();
}
 
开发者ID:wavinsun,项目名称:MUtils,代码行数:18,代码来源:VideoActivity.java

示例13: onCreate

import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_video_bmx);

    String uriPath = "android.resource://mx.ambmultimedia.brillamexico/raw/bmx_video";
    Uri uri = Uri.parse(uriPath);

    video = (VideoView) findViewById(R.id.videoView);
    video.setVideoURI(uri);

    MediaController mediaController = new MediaController(this);
    mediaController.setAnchorView(video);
    video.setMediaController(mediaController);

    video.start();
    video.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
        @Override
        public void onCompletion(MediaPlayer vmp) {
            Intent intent = new Intent(VideoBMX.this, LoginStep1.class);
            startActivity(intent);
        }
    });
}
 
开发者ID:dannegm,项目名称:BrillaMXAndroid,代码行数:25,代码来源:VideoBMX.java

示例14: onCreate

import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  vv=new VideoView(this, null);
  setContentView(vv,
    new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT,
      Gravity.CENTER));
  vv.setVideoURI(getIntent().getData());
  vv.setOnCompletionListener(this);
  vv.start();

  if (savedInstanceState!=null) {
    vv.seekTo(savedInstanceState.getInt(STATE_OFFSET, 0));
  }
}
 
开发者ID:commonsguy,项目名称:cwac-cam2,代码行数:17,代码来源:VideoPlayerActivity.java

示例15: onCreate

import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_video_view);

    ActionBar ab = getSupportActionBar();
    if (ab != null) {
        ab.setDisplayHomeAsUpEnabled(true);
    }

    String imageUrl = getIntent().getStringExtra("videoUrl");

    Uri uri = Uri.parse(imageUrl);
    vidMessageVideo = (VideoView)findViewById(R.id.vidMessageVideo);
    vidMessageVideo.setMediaController(new MediaController(this));
    vidMessageVideo.setVideoURI(uri);
    vidMessageVideo.requestFocus();
    vidMessageVideo.start();
}
 
开发者ID:magnetsystems,项目名称:message-samples-android,代码行数:20,代码来源:VideoViewActivity.java


注:本文中的android.widget.VideoView.setVideoURI方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。