TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Laxman Dussa
NA
117
4.3k
MVC with Jquery
Dec 17 2018 5:32 AM
how to upload MP4 Video files, save (insert) to database table, retrieve (display) files from database table using Entity Framework and play the files with Live Streaming from database table using HTML5 Video Player in ASP.Net MVC jquery Pleasse sent Simple code
my code is
[HttpPost]
public
FileResult DisplayImage(
string
name,
string
email)
{
byte
[] data;
UserImage user = db.UserTable.Where(X => X.UserName == name && X.Email == email).FirstOrDefault();
if
(user!=
null
)
{
string
imreBase64Data = Convert.ToBase64String(user.photos);
//string imgDataURL = string.Format("data:image/png;base64,{0}", imreBase64Data);
string
audioDataURL =
string
.Format(
"data:audio/mp3;base64,{0}"
, imreBase64Data);
//return Json(new { data = audioDataURL }, JsonRequestBehavior.AllowGet);
data = (
byte
[])user.photos;
return
File(data,
"audio/mp3"
);
}
return
null
;
}
SCRIPT
<script>
$(
function
() {
alert(
"hai"
)
$.get(
"/Home/DisplayAudio?id='"
+ 2006 +
"'"
,
function
(response) { audio.src =
'data:audio/mp3;base64,'
+ response.data +
''
; })
//$.ajax({
// type: "POST",
// url: "/Home/DisplayAudio",
// data: " {id:'" + $("#txtid").val() + "'}",
// contentType: "application/json; charset=utf-8",
// dataType: "File",
// success: function (data, status) {
// alert("hai")
// $.each(data, function (index, value) {
// // audio.src = 'data:audio/jpg;base64,' + value.data + ' type = "audio/mp3";
// audio.src = 'data:audio/mp3;base64,'+ value.data + '';
// })
// }
//})
})
</script>
<body>
<input id=
"txtid"
/><br />
<input type=
"submit"
value=
"Submit"
id=
"btnPost"
onclick=
"InsertData()"
/>
<audio controls>
<source src=
""
/>
</audio>
</body>
Reply
Answers (
1
)
css and javascript
Big Red 'X' Exception in C# winform application.