有时视频加载得很好,有时需要永久​​加载,或根本不加载? [英] video loads fine sometimes, and other times it takes forever to load, or doesn't load at all?

查看:225
本文介绍了有时视频加载得很好,有时需要永久​​加载,或根本不加载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有10秒的视频剪辑,以及该视频剪辑来自我的网站的完整视频。 10秒的视频设置为(自动播放,预加载=自动和静音),并将完整视频设置为(预加载=无),并且设置为仅在单击时加载。这些视频都是.mp4。



我将我的网站发布到我的计算机上的IIS,然后转到localhost,网站将加载正常。 10秒的视频在我的视频轮播中加载得很好,但是当我点击该视频转到关于视频的专用页面时,10秒视频将按照它应该加载的方式进行加载,或者要么加载几秒钟,要么不加载加载的所有??



完整的视频将加载完美的每一次,即使10秒的视频不加载我仍然可以点击它应该是空间(我有一个被点击的div,激活完整的视频而不是点击剪辑),完整的视频将打开,并开始播放罚款?

我无法弄清楚什么是导致这个问题,因为视频将在主页面上正常加载,即使同时在传送带上加载5个其他视频,但是当它在其自己的页面上几乎不会每次加载时。我尝试清除缓存并重新加载页面,但仍然有90%的时间只是不加载?

那么有人可以告诉我什么可能会导致10秒的视频2.2MB在预加载时不加载,但90.2mb的视频会立即加载预加载关闭?即使我重新加载页面,然后点击立即加载完整的视频,它会立即加载?我真的在主页上有相同的代码来获取视频剪辑并播放它,每次都有效!



10秒剪辑:我有这些带有ID的视频剪辑div,因此div可以加载到加载视频的其他页面上。

 < video preload =autosrc =@ Url.Content(\"~/Content/Video/\")@item.clipautoplay loop = muted style =width:100%;>< / video> 

完整视频:

 < video id =videoClick1controlsList =nodownloadsrc =@ Url.Content(\"~/Content/Video/\")@item.selectFilepreload =nonecontrols style =宽度:100%;>< /视频> 

这里是视频加载的地方:

 < div id =fullVideoClick> 
< div id =video2>
< / div>
< div id =video1>
< / div>
< / div>
< script>
$(#video1)。load(/ VideoCarousels / index#profileVideo1);
$(#video2)。load(/ VideoCarousels / index#carouselVideo1);
< / script>

和主页面:

 < div id =video1> 
< / div>
< script>
$(#video1)。load(/ VideoCarousels / index#carouselVideo1);
< / script>

我能想到的唯一情况是视频剪辑的预加载有时并不会激活这是因为它在5%的时间内完美工作,5%的时间比平常花费的时间更长,但仍然会加载,另外90%的时间只是从不加载,但在主页上加载完美95 %的时间,其他5%的时间最终会加载,但需要更长时间才能正常运行。



- edit -



我已经将我的5个视频轮播设置为在每张幻灯片上播放相同的视频剪辑,并且在我清除缓存后重新加载页面时,似乎在5张幻灯片中加载了3张视频,第二次加载页面时,我会重新加载它们,但仍然在专用页面上,它不会加载剪辑。我还加入了
$(document).ready(function(){...});它首先加载了剪辑,这让我希望这将是答案,但在刷新页面后,即使在清除缓存后它仍然无法加载,如果要加载或不加载,它是随机的。



- edit2--
找到了最奇怪的东西!我检查了元素,并从弹出的视频中删除了完整的视频,因为它后面是视频剪辑,所以我能够看到视频剪辑的视频控件,而奇怪的是视频剪辑实际上加载得很好,但最奇怪的是点击播放什么都不做?我点击播放,然后我必须点击几秒钟进入视频,然后开始播放?任何人都有任何想法,为什么发生这种情况?

解决方案


$ b

  $(document).ready(function(){...}); 

永远是任何加载问题的开始。


I have a 10 second video clip, and a full video that the video clip is from on my site. the 10second video is set to (autoplay, preload=auto, and muted), and the full video is set to (preload=none) and is set to only load when clicked. the videos are both .mp4.

I publish my site to IIS on my computer, and I go to localhost, and the site will load fine. The 10second video loads fine on my video carousel, but when I click it to go to the dedicated page about the video the 10second video will either load like it should, or either it will take a few extra seconds to load, or doesn't load at all??

The full video will load perfect every time even if the 10second video doesn't load I can still click the space where it should be (I have a div that's clicked that activates the full video not the click of the clip), and the full video will open, and start playing fine?

I cannot figure out what is causing this issue since the video will load fine on the main page even if 5 other vidoes are loading on the carousel at the same time, yet when its on its own page it just doesn't load almost every time..? I try clearing cache, and reloading the page, but still 90% of the time it just doesn't load?

so can someone tell me what could be causing a 10second video 2.2mb to not load when preload is on, but a video that's 90.2mb will load when activated instantly even though preload is off?? even if I reload the page, and click to load the full video right away it will load almost instantly?? I literally have the same code on the main page to get the video clip and play it which works every time!

10second clip: I have divs around these video clips that have an id so the div can be loaded on other pages which loads the videos.

<video preload="auto" src="@Url.Content("~/Content/Video/")@item.clip" autoplay loop="" muted style="width:100%;"></video>

full video:

<video id="videoClick1" controlsList="nodownload" src="@Url.Content("~/Content/Video/")@item.selectFile" preload="none" controls style="width:100%;"></video>

here is where the videos get loaded:

<div id="fullVideoClick">
     <div id="video2">
     </div>
     <div id="video1">
     </div>
</div>
<script>
     $("#video1").load("/VideoCarousels/index #profileVideo1");
     $("#video2").load("/VideoCarousels/index #carouselVideo1");
</script>

and on the main page:

<div id="video1">
</div>
<script>
     $("#video1").load("/VideoCarousels/index #carouselVideo1");
</script>

the only thing I can think of is the preload for the video clip isn't activating sometimes for some reason since it works perfect about 5% of the time, and 5% of the time it takes longer than usual, but still loads, and the other 90% of the time it just never loads, yet on the main page it loads perfect 95% of the time, and the other 5% of the times it will load eventually, but takes longer then normal.

--edit--

I have set my 5 video carousel to play the same video clip on each slide, and it seems to load the video 3 out of 5 slides when I reload the page after I clear cache, but when I reload the page the second time it loads them all fine, but still on the dedicated pages it just doesn't load the clip. I also added in $(document).ready(function(){ ... }); which at first loaded the clip, which made me hopeful that that would be the answer, but after refreshing the page again the clip didn't load anymore even after clearing cache it was random if it was going to load or not.

--edit2-- found the weirdest thing! I inspected elements, and deleted the full video from poping up because behind it is the video clip so I was able to see the video controls for the video clip, and whats weird is the video clip is actually loaded fine, but the weirdest thing is that clicking play does nothing?? I click play, and then I have to click a few seconds into the video, and then it starts playing??? anyone have ANY idea why this is happening??

解决方案

You haven't wrapped your jQuery code in

$(document).ready(function(){ ... });

Always a good place to start with any load issue.

这篇关于有时视频加载得很好,有时需要永久​​加载,或根本不加载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆