Sou*_*sal 4 android video-streaming
是否有可能在Android中获取任何类型视频的缩略图,某人只有该视频的网址链接,视频可以来自任何来源,如youtube或任何来源.请告诉我,如果有可能.这是我的我试图获取youtube视频缩略图的java代码..
public class MainActivity extends Activity {
String path = "http://www.youtube.com/watch?v=HMMEODhZUfA";
Bitmap bm;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ImageView image_View = (ImageView) findViewById(R.id.image);
bm = ThumbnailUtils.createVideoThumbnail(path,
MediaStore.Images.Thumbnails.MICRO_KIND);
image_View.setImageBitmap(bm);
}
and this is my xml..
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/hello_world" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
我不认为你可以通过将视频链接提供给ThumbnailManager来生成视频的缩略图,
我建议的两种方法是
如果您正在使用某些第三方服务器,例如.youtube或其他什么,然后他们将有视频缩略图的单独链接.