d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Playing Video From Mysql In Jsp
Add Reply New Topic New Poll
Member
Posts: 1
Joined: Apr 22 2016
Gold: 0.00
Apr 22 2016 01:58pm
video player does show up but it doesnt play video.


I did upload 1mb video mp4 format in mysql through blob

anyone know what's the problem here?

Code
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page import="java.sql.*" %>
<% Class.forName("com.mysql.jdbc.Driver"); %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<FORM ACTION="playdb.jsp" METHOD="POST">

<BR>
<INPUT TYPE="TEXT" NAME="username">
<BR>
<INPUT TYPE="SUBMIT" value="Submit">
<%
Connection c = DriverManager.getConnection("jdbc:mysql://localhost/test","root","5845#Mankind");

Statement statement = c.createStatement();



String id = request.getParameter("username");


ResultSet resultset =
statement.executeQuery("select video from applicant where username = '"+id+"'") ;

if(!resultset.next()) {
} else {
%>
<body><div class="media">

<video width="320" height="240" controls>
<source src="<%=resultset.getString("video")%>" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
</video>
</div>
</div>
</body>
<%
}
%>
</FORM>
</html>
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Apr 22 2016 02:32pm
Have you tried createObjectUrl?

If you're not sure where the problem is, I suggest looking at the html after it's processed and verify it looks correct. I'm not familiar enough with the video tag to know if it accepts a blob. I'm also not sure why you have two sources defined
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll