我正在尝试制作添加视频并播放它的项目 在我上传视频并按播放后,如果视频超过4 mb,那么它不会播放视频吗?
仅限Chrome浏览器
@model VideoWeb.Video
@{
ViewBag.Title = "Video";
Layout = "~/Views/_Layout.cshtml";
}
<h2>Video</h2>
@using (Html.BeginForm())
{
<div id="jp_container_1" class="jp-video " role="application" aria-label="media player">
<div class="jp-type-single">
<div id="jquery_jplayer_1" class="jp-jplayer"></div>
<div class="jp-gui">
<div class="jp-video-play">
<button class="jp-video-play-icon" role="button" tabindex="0">play</button>
</div>
<div class="jp-interface">
<div class="jp-progress">
<div class="jp-seek-bar">
<div class="jp-play-bar"></div>
</div>
</div>
<div class="jp-current-time" role="timer" aria-label="time"> </div>
<div class="jp-duration" role="timer" aria-label="duration"> </div>
<div class="jp-details">
<div class="jp-title" aria-label="title"> </div>
</div>
<div class="jp-controls-holder">
<div class="jp-volume-controls">
<button class="jp-mute" role="button" tabindex="0">mute</button>
<button class="jp-volume-max" role="button" tabindex="0">max volume</button>
<div class="jp-volume-bar">
<div class="jp-volume-bar-value"></div>
</div>
</div>
<div class="jp-controls">
<button class="jp-play" role="button" tabindex="0">play</button>
<button class="jp-stop" role="button" tabindex="0">stop</button>
</div>
<div class="jp-toggles">
<button class="jp-repeat" role="button" tabindex="0">repeat</button>
<button class="jp-full-screen" role="button" tabindex="0">full screen</button>
</div>
</div>
</div>
</div>
<div class="jp-no-solution">
<span>Update Required</span>
To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
</div>
</div>
</div>
}
@using (Html.BeginForm("AddComment", "Home", FormMethod.Post))
{
@*<fieldset class="col-md-1">*@
<input name="videoId" type="hidden" value="@Model.Id"></input>
<div class="form-group col-sm-10">
<label for="name" class="sr-only">Name:</label>
<input type="text" class="form-control" name="name" id="Name" placeholder="your name" />
</div>
<div class="form-group col-sm-10">
<label for="email" class="sr-only">Email:</label>
<input type="email" class="form-control" name="email" id="Email" placeholder="email@some.com" />
</div>
<div class="form-group col-sm-10">
<label for="message" class="sr-only">Your Comment:</label>
<textarea type="text" class="form-control" name="message" id="Message" placeholder="some comment on video" ></textarea>
</div>
<div class="form-group col-sm-10">
<label for="startTime" class="sr-only">startComment:</label>
<input type="text" class="form-control" name="startTime" id="StartTime" placeholder="starts? mm:ss" />
</div>
<div class="form-group col-sm-10">
<label for="endTime" class="sr-only">Video description:</label>
<input type="text" class="form-control" name="endTime" id="EndTime" placeholder="ends? mm:ss"/>
</div>
<input type="submit" value="AddComment" class="btn btn-default" />
<br><br>
@ViewBag.Message
}
@using (Html.BeginForm())
{
if (Model.Comments != null)
{
foreach (var item in Model.Comments)
{
<div class="form-group col-sm-10">
@Html.DisplayName(item.Name)
</div>
<div class="form-group col-sm-10">
@Html.DisplayName(item.Message)
</div>
}
}
}
<link type="text/css" rel="stylesheet" href="~/Skin/jplayer.pink.flag.css" />
<script type="text/javascript" src="~/Scripts/jquery-2.2.0.min.js"></script>
<script type="text/javascript" src="~/Scripts/jquery.jplayer.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#jquery_jplayer_1").jPlayer({
ready: function () {
$(this).jPlayer("setMedia", {
title: "@Model.Description",
m4v: "@Model.Url",
ogv: "@Model.Url"
});
},
cssSelectorAncestor: "#jp_container_1",
swfPath: "/js",
supplied: "m4v, ogv",
useStateClassSkin: true,
autoBlur: false,
smoothPlayBar: true,
keyEnabled: true,
remainingDuration: true,
toggleDuration: true
});
});
这是我的网络配置
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=301880
-->
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<connectionStrings>
<add name="VideoWebConnectionString" connectionString="Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\New\Documents\visual studio 2015\Projects\VideoWeb\VideoWeb\App_Data\VideoWeb.mdf;Integrated Security=True" providerName="System.Data.SqlClient" />
<add name="videoWebEntities" connectionString="metadata=res://*/Models.Model1.csdl|res://*/Models.Model1.ssdl|res://*/Models.Model1.msl;provider=System.Data.SqlClient;provider connection string="data source=NEW-PC;initial catalog=videoWeb;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
<add name="vid" connectionString="data source=NEW-PC;initial catalog=videoWeb;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />
<add name="VideoWebConnectionString1" connectionString="Data Source=orenlap;Initial Catalog=VideoWeb;Integrated Security=True;Pooling=False" providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5.2" maxRequestLength="1048576" />
<httpModules>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />
</httpModules>
</system.web>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" />
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" />
</compilers>
</system.codedom>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules>
<remove name="ApplicationInsightsWebTracking" />
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
</modules>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824" />
</requestFiltering>
</security>
</system.webServer>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>
没有错误或例外只是播放超过4 mb的大型视频,但我可以上传大型视频 如果你将提供我将提供的其他代码,但我认为不需要 如果您有其他建议播放上传视频(更多格式),请告诉我
答案 0 :(得分:1)
我认为你正在超载浏览器缓存。您应该选择在某些文件中保存服务器端的大块数据流(如果您想保存它)和本地cookie。当您发送数据包时 - 请尽快将其删除以释放浏览器内存以加载下一个数据块。
希望它能解决您的问题。
如何将它释放为chrome?
例如,如果我想通过ajax执行此操作: (jQuery Ajax File Upload)
释放此内存只是将其替换为新块(free&amp; load)或删除它并在另一个变量中加载下一个块。
随意发表评论。 您应该使用WebRTC或WebSocket来使其健壮,快速和高效。 session_id用于许多传入视频的基本支持。