在Smart Watch和Android Wear中播放视频文件

时间:2016-09-27 06:26:05

标签: android

我喜欢在Android Wear中播放我的视频文件,但我发现Android Wear不支持videoview

有替代方案吗?

InputStream ins = MainActivityBackup.this.getResources().openRawResource (R.raw.hyperlapse2);
File tmpFile = null;
OutputStream output;

try {

    tmpFile = File.createTempFile("video","mov");
    output = new FileOutputStream(tmpFile);

    final byte[] buffer = new byte[102400];
    int read;

    while ((read = ins.read(buffer)) != -1) {
        output.write(buffer, 0, read);
    }
    output.flush();
    output.close();
    ins.close();
} 

catch (IOException e) 
{

e.printStackTrace();

}

0 个答案:

没有答案