我正在尝试创建一个应该播放多个视频的DayDream
服务。
我设法显示DayDream
服务,但视频无法播放....只显示黑屏。
没有错误或例外。
package com.android.DayVideoDream;
import android.net.Uri;
import android.service.dreams.DreamService;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Toast;
import android.widget.VideoView;
public class DVDmain extends DreamService implements OnClickListener {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
try {
setContentView(R.layout.main);
// Displays a video file.
VideoView mVideoView = (VideoView) findViewById(R.id.VideoView);
String uriPath = "android.resource://com.android.AndroidVideoPlayer/"
+ R.raw.filme3_h264;
Uri uri = Uri.parse(uriPath);
mVideoView.setVideoURI(uri);
mVideoView.requestFocus();
mVideoView.start();
} catch (Exception e) {
Toast.makeText(getApplicationContext(), e.getMessage(),
Toast.LENGTH_LONG).show();
}
Toast.makeText(getApplicationContext(), "Video is playing",
Toast.LENGTH_LONG).show();
}
}
找不到问题。谢谢你的帮助。