0
我從Oracle數據庫中使用Java和發送響應與這裏的base64值檢索視頻不工作是我的Java代碼添加SRC到視頻信號源時的base64添加到src
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{ String video64="";
System.out.println("service");
try {
PreparedStatement ps=cn.prepareStatement("select * from video ");
ResultSet rs=ps.executeQuery();
rs.next();
Blob vedio=rs.getBlob(1);
System.out.println("try");
if(vedio !=null)
{
byte videobytes[]=vedio.getBytes(1,(int)vedio.length());
video64 = DatatypeConverter.printBase64Binary(videobytes);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println(video64);
response.getWriter().write(video64);
}
here is my html
<video controls>
<source type="video/mp4" id="v">
</video>
我使用AJAX調用發送請求並使用jquery 加入我的<source type="video/mp4" id="v">
響應這裏是AJAX
$("#sub").click(function(){
$.ajax({
url:"RetriveVedio",
method: "get",
dataType: 'text',
success:function(response){
console.log(response);
$("#v").attr("src",'data:video/mp4;base64,'+response);
$("#v").load();
}
});
});
但src
不獲取添加到源,並base64
價值也沒有工作video tag
這是base64價值,我得到的迴應AAAAGGZ0eXBtcDQyAAAAAG1wNDFpc29tBNjldm1kYXQAAAAAAAAAEAA=
這是什麼問題?