How to load the video at a specific time? [duplicate] - javascript

This question already has answers here:
html5 video button that takes video to specific time
(2 answers)
Closed 9 months ago.
Edit: I have reviewed the other posts with a similar question and those do not resolve this issue. The #-t open just gets passed as a GET variable to my proxy script.
The following is to load a video. The source of the video is a php script that checks to ensure user is logged in then outputs the video. This is to ensure that only people logged in can download the video.
How do I specify a time to start the video position at?
<video id="test" width="640" height="360" controlsList="nodownload" controls>
<source src="vidRedir.php?v=video" type="video/mp4">
Your browser does not support the video tag.
</video>

Append #t=<time in seconds> to the URL. For example, setting src to vidRedir.php?v=video#t=30 will start the video at 30 seconds.
See this MDN article.

const video = document.querySelector('video');
video.currentTime = <Your time here>
https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/currentTime

Related

Playing links to audio on click [duplicate]

This question already has answers here:
switch audio source with jquery and HTML5 audio tag
(2 answers)
Closed 3 years ago.
My web page includes a bunch of links that are generated via php. These are links to mp3 files, and right now when I click on them the sound starts playing in a new tab. How can I add a script so that all links start playing the source sound directly in the same tab when clicked (and stop when re-clicked)? Apologies in advance for a possibly stupid question, but please have mercy as I am very new to all of these things.
value1
value2
value3
You should be using an audio tag like the following:
<audio controls>
<source src="horse.mp3" type="audio/mpeg">
Your browser does not support the audio tag.
</audio>
Read more here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/
Also, the target="_blank" attribute will cause the link to open in a new tab.
Good luck on your coding journey!

html5 audio volume does not change [duplicate]

I embedded a background audio into my website which autoplays on visit.
The source of the audio is a online stream hotlink.
<audio autoplay>
<source src="http://lel.com/link/to/stream.m3u">
</audio>
I already managed to do that and it's working well.
Now I want to turn down the volume of the stream because the audio should just stay in the background and entertain the visitors instead of giving them ear cancer due to loudness.
I already searched the forums but I always found solutions for turning the volume of a video.
I also searched for the parameters of the audio tag but there seems no volume parameter for the audio tag.
Don't worry about legalities. The stream I use for the website has no copyright and I am permitted to use it on my website.
Theres no volume attribute supported by browsers so you must set the volume property in JavaScript
<audio autoplay id="myaudio">
<source src="http://lel.com/link/to/stream.m3u">
</audio>
<script>
var audio = document.getElementById("myaudio");
audio.volume = 0.2;
</script>
See http://jsfiddle.net/sjmcpherso/6r1emoxq/

Disable the HTML5 information from YouTube Embedded Video [duplicate]

I have a small project of doing some html5 videos embed on a site.
I use a simple HTML video embed code
<video width="560" height="340" controls>
<source src="path/to/myvideo.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'>
<source src="path/to/myvideo.ogv" type='video/ogg; codecs="theora, vorbis"'>
</video>
so my question is that possible to disable the copy URL when you right click on the video?
I know if they really want to get the video link there are ways to do so.
but just at least if I can do that one.
Thanks
You can catch right-clicks via JavaScript and thus prevent the right-click menu.
As you correctly noted though, it’s only a hindrance rather than prevention. HTML5 video is about direct integration into the browser and thus can also be saved like images, for example.

HTML5 video tag in IE plays 2 tracks simultaneously instead of one

I have this page
http://joewillhelpyou.com
Users click the blue botton and a video page begins to play.
I have it simple. an iframe so the Jquery dows not mess with my tag that I found would not allow me to autoplay the next video, and 2 src for each video. In all the browswers they work okay, only one video is played back mp4 or webm. but in IE I keep hearing two playing back and I cannot figure out why
you can visit the page and tell me if you catch my mistake or a workaround for IE
<div id="videodiv">
<iframe src="http://joewillhelpyou.com/videos/step2/play02_01.html" width="1000" height="750"></iframe>
</div>
then this leads to a page where I have the video
<video controls autoplay width="936" height="624">
<source src="002_001.mp4" type="video/mp4">
<source src="002_001.webm" type="video/webm">
Your browser does not support the video tag.
</video>
under normal situations the code only plays one choce right? but in IE it seems to play 2 things at once, the rest of the browsers only sound out one track and that is what I want

After movie clip redirect to subpage

I need to know how to do a page containing a fullscreen movie clip as a intro for the site, after the movie is finish it will redirect the visitors (without clicking) to a subpage.
Is this possible to do?
No flash, javascript or/and PHP only.
I'm just going to assume you're using the video element.
<video id="somevideo" width="420">
<source src="mov_bbb.mp4" type="video/mp4">
<source src="mov_bbb.ogg" type="video/ogg">
Your browser does not support HTML5 video.
</video>
Now add your event
document.getElementById("somevideo").addEventListener('ended',function (e) {
window.location = "http://stackoverflow.com/questions/19795419/after-movie-clip-redirect-to-subpage";
});
You may want to set up some timers or custom handling as this will redirect to the next page the moment your video completes but that's all up to your site spec

Categories