Android: get stored video from database

 ̄綄美尐妖づ 提交于 2019-12-12 03:04:51

问题


I've prepared sqlite database in SQLite Manager with all data added manually. This db stored images (BLOB), text and video (BLOB) files. I cannot store only URL/SD card link to videos but whole file in database. I easily can get text and images from database and show in my application.

For images code below:

Cursor cursor = myDbHelper.getData(); // select from database text, images(BLOB) and videos(BLOB).  

...
ByteArrayInputStream inputStream = new ByteArrayInputStream(cursor.getBlob(1));  //image
Bitmap b = BitmapFactory.decodeStream(inputStream);  
ImageView iv = new ImageView(this);  
iv.setImageBitmap(b);  

And it is working. But I don't know how to get video from BLOB and display/play in VideoView field using:

ByteArrayInputStream inputStream = new ByteArrayInputStream(cursor.getBlob(2));  //video

How to put inputStream to VideoView or other format to display in application. Please help.

EDIT: I stored whole database (with text,images and videos) on device. I connect with external database (MySQL) only for update. And after updating records i.e. with movies, device doesn't use Internet connection any more.


回答1:


Here you go Tom, you just want to do streaming:

https://stackoverflow.com/a/2059259/413127



来源:https://stackoverflow.com/questions/10182457/android-get-stored-video-from-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!