我希望我的视频能像facebook和Instagram一样自动播放 我正在使用jwplayer
我的代码:
PlaylistItem item = new PlaylistItem.Builder()
.file("http://techslides.com/demos/sample-videos/small.mp4")
.description("Some really great content")
.title("Video Sample")
.build();
PlayerConfig playerConfig = new PlayerConfig.Builder()
.logoFile("jw_logo.png")
.autostart(true)
.repeat(false)
.build();
JWPlayerView playerView = new JWPlayerView(context, playerConfig);
ViewGroup jwPlayerViewContainer = (ViewGroup) findViewById(R.id.playerView1);
jwPlayerViewContainer.addView(playerView);
playerView.load(item);
JWPlayerView playerView2 = new JWPlayerView(context, playerConfig);
ViewGroup jwPlayerViewContainer2 = (ViewGroup) findViewById(R.id.playerView4);
jwPlayerViewContainer2.addView(playerView2);
playerView2.load(item);