Android Question How can play an mp4 video file stored in my database

Makumbi

Well-Known Member
Licensed User
B4X:
Using br As New BinaryReader(FileUpload1.PostedFile.InputStream)
            Dim bytes As Byte() = br.ReadBytes(CInt(FileUpload1.PostedFile.InputStream.Length))
            Dim strConnString As String = ConfigurationManager.ConnectionStrings("constr").ConnectionString
            Using con As New SqlConnection(strConnString)
                Using cmd As New SqlCommand()
                    cmd.CommandText = "insert into tblFiles(Name, ContentType, Data) values (@Name, @ContentType, @Data)"
                    cmd.Parameters.AddWithValue("@Name", Path.GetFileName(FileUpload1.PostedFile.FileName))
                    cmd.Parameters.AddWithValue("@ContentType", "video/mp4")
                    cmd.Parameters.AddWithValue("@Data", bytes)
                    cmd.Connection = con
                    con.Open()
                    cmd.ExecuteNonQuery()
                    con.Close()
                End Using
            End Using
        End Using

i have this code which saves the video into the sqlserver database
now i wanted to retrieve that byte file and play it using the example in exo player please help
 

Attachments

  • Backup 1 2020-05-15 20.37.zip
    9.1 KB · Views: 252

asales

Expert
Licensed User
Longtime User
Not for the video files, but I think that you can use this codes below (that upload a image file) and change it to upload the video file.

You can search too in the forum to "upload file" and "upload image", etc. and find several threads that can made it a direction.

 
Upvote 0
Top