我只想在 android.i 中实现 Brightcove 播放器
http://support.brightcove.com/en/docs/accessing-video-content-media-api
http://support.brightcove.com/en/docs/best-practices-android-app-development
我在videocloud上获得了特定视频的VideoId,Video_fields。我只想在android本机应用程序的brightcove播放器上使用这些信息播放该视频。
我的代码:
私有静态最终字符串 MyApiToken = "我的令牌"; 私有 ReadAPI mReadAPI = new ReadAPI(MyApiToken); 私人 com.brightcove.mobile.mediaapi.model.Video pVideo;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
makeAPICall();
}
私人无效 makeAPICall() {
Log.d("Sample", "Beginning makeAPICall");
EnumSet<VideoFieldEnum> videoFields = VideoFieldEnum.createEmptyEnumSet();
videoFields.add(VideoFieldEnum.NAME);
videoFields.add(VideoFieldEnum.LENGTH);
videoFields.add(VideoFieldEnum.FLVURL);
try {
long videoId =My videoId;
pVideo = mReadAPI.findVideoById(videoId, videoFields, null);
} catch(Exception e) {
String msg = e.getMessage();
Log.e("Sample", msg);
}
//Create the player
BCPlayerView mPlayer;
mPlayer = (BCPlayerView) findViewById(R.id.player);
mPlayer.load(pVideo);
mPlayer.start();
}
}
我还添加了诸如 bc-android-mediapi.jar 和 bc-android-player.jar 之类的库 jar。当我尝试运行时。,我得到了黑屏,视频播放器控制器可见。但是视频没有播放。我需要包括的任何内容更远?
谢谢。