I don’t want to create a proof of concept that shows the user that if they upload the same video in .MP4 and OGG format, the created video tag (using videojs) will be cross-platform.
I successfully created the file downloader using the constructor and uploaded files up to 512 MB into the “files” folder inside the solution, but I would like to know how to refresh the web page using the generated video tag.
This is the tag I would like to change:
<video id="example_video_1" class="video-js vjs-default-skin"
controls preload="auto" width="640" height="264"
poster="http://video-js.zencoder.com/oceans-clip.png"
data-setup='{"example_option":true}'>
<source id="mp4" src="http://video-js.zencoder.com/oceans-clip.mp4" type='video/mp4' />
<source id="webm" src="http://video-js.zencoder.com/oceans-clip.webm" type='video/webm' />
<source id="ogg" src="http://video-js.zencoder.com/oceans-clip.ogv" type='video/ogg' />
</video>
My save method:
protected void btnUpload_Click(object sender, EventArgs e){
if (FileUpload1.HasFile) {
string fileName = Path.Combine(Server.MapPath("~/Files"), FileUpload1.FileName);
FileUpload1.SaveAs(fileName);
}
}
EDIT:
I have a solution almost now. somehow, it doesn’t fit the right path. The solution I created:
<script type="text/javascript">
var _strSource = '<ASP:LITERAL runat="server" id="litSource" />';
window.onload = function ()
{
if ( _strSource != "" ) {
alert( _strSource );
var video = document.getElementById( 'objVideo' );
var sources = video.getElementsByTagName( 'source' );
alert( sources[0].src );
sources[0].src = _strSource;
video.load();
video.play();
}
}
</script>
And on the server side:
protected void btnUpload_Click(object sender, EventArgs e){
if (FileUpload1.HasFile) {
string fileName = Path.Combine(Server.MapPath("/Files"), FileUpload1.FileName);
FileUpload1.SaveAs(fileName);
this.litSource.Text = fileName.Replace("\\", "\\\\");
}
}
I also added this to my web.config:
<staticContent>
<mimeMap fileExtension=".mp4" mimeType="video/mp4" />
<mimeMap fileExtension=".ogg" mimeType="video/ogg" />
<mimeMap fileExtension=".webm" mimeType="video/webm" />
<mimeMap fileExtension=".m4v" mimeType="video/m4v" />
</staticContent>
( ). C:\Projects\FileUploadTest\FileUploadTest\Files\c4b3ae2189ea.ogg. , , . - , ?