首页 > 学院 > 开发设计 > 正文

Vitamio的使用

2019-11-09 13:54:59
字体:
来源:转载
供稿:网友

Vitamio的使用

1.导入library_vitamio库 2.AndroidManifest.xml中加入这个代码

<!-- Don't forgot InitActivity --><activity android:name="io.vov.vitamio.activity.InitActivity" android:configChanges="orientation|screenSize|smallestScreenSize|keyboard|keyboardHidden|navigation" android:launchMode="singleTop" android:theme="@android:style/Theme.NoTitleBar" android:windowSoftInputMode="stateAlwaysHidden" />

3.修改library_vitamio库文件中的gradle文件中对应的内容为,这个两句话是从自己项目中拷贝的

compileSdkVersion 23buildToolsVersion "24.0.3"

这里写图片描述

4.播放视频

/** * 播放视频 * * @param mVideoView * @param path */void playfunction(VideoView mVideoView, String path) { mVideoView.setVideoPath(path); mVideoView.setMediaController(new MediaController(context)); mVideoView.requestFocus(); mVideoView.setOnPReparedListener(new MediaPlayer.OnPreparedListener() { @Override public void onPrepared(MediaPlayer mediaPlayer1) { mediaPlayer = mediaPlayer1; mediaPlayer.setPlaybackSpeed(1.0f); mediaPlayer.setLooping(true); mediaPlayer.start(); } });}

5.最重要的一步Myapplication中,一定要注册,创建MyApplication,在onCreate()方法中添加如下代码

//初始化Vitamio播放器视频Vitamio.isInitialized(getApplicationContext());
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表