1***@qq.com
1***@qq.com
  • 发布:2019-01-20 00:42
  • 更新:2019-01-20 00:42
  • 阅读:1893

阿里云 视频播放器 集成问题,求解,来个官方的,这个对好多人都用的到

分类:5+ SDK

我参考了这位朋友的做法,我的不会出界面http://ask.dcloud.net.cn/article/13410

官方集成说明:https://help.aliyun.com/document_detail/61908.html?spm=a2c4g.11186623.6.979.eef7533coq6MOI

求解,求解,求解,求解,来个官方的,这个对好多人都用的到

我的代码

private static final int REQUEST_CODE_RECORD_VIDEO= 1002;
private String pUrl="";
private String pErr="";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
Intent intent = this.getIntent();
String datajson= intent.getCharSequenceExtra("datajson").toString();
try {
JSONObject object=new JSONObject(datajson);
pUrl=object.getString("url");

    } catch (JSONException e){  
        e.printStackTrace();  
    }  
    AliVcMediaPlayer.init(getApplicationContext());  
    AliVcMediaPlayer mPlayer = new AliVcMediaPlayer(this,new SurfaceView(this));  
    mPlayer.setErrorListener(new MediaPlayer.MediaPlayerErrorListener() {  
        @Override  
        public void onError(int i, String msg) {  
            //错误发生时触发,错误码见接口文档  
            Log.println(i,"ERROR",msg);  
            pErr=msg;  
        }  
    });  
    mPlayer.prepareToPlay(pUrl);  
    mPlayer.play();  
}  
protected void onActivityResult(int requestCode, int resultCode, Intent data)  
{  
    Intent intent=new Intent();  
    if(requestCode ==REQUEST_CODE_RECORD_VIDEO)  
    {  
        if(resultCode == Activity.RESULT_OK && data!= null)  
        {  
            intent.putExtra("resultCode","000000");  
            intent.putExtra("type","RECORD");  
            intent.putExtra("path",pUrl);  

        }else if(resultCode == Activity.RESULT_CANCELED)  
        {  
            intent.putExtra("err",pErr);  
            intent.putExtra("resultCode","-1");  
        }  
    }  
    else {intent.putExtra("resultCode","-2");}  
    setResult(RESULT_OK,intent);  
    this.finish();  
}
2019-01-20 00:42 1 条评论 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复