0

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.

Tom B
  • 57
  • 4
  • 9

1 Answers1

3

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

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

Community
  • 1
  • 1
Blundell
  • 75,855
  • 30
  • 208
  • 233
  • Thanks for reply. It is streaming video from external source tutorial. I want to get video from database (from field BLOB, NOT in some folder of SD Card) located on device (smartphone) and play in application. – Tom B Apr 17 '12 at 07:33
  • 1
    Once you changed it into an InputStream it's irrelevant where you got it from. – Blundell Apr 17 '12 at 12:09