Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #26281 > unrolled thread
| Started by | Andrew Poulos <ap_prog@hotmail.com> |
|---|---|
| First post | 2014-12-09 13:31 +1100 |
| Last post | 2014-12-10 03:40 -0800 |
| Articles | 10 — 5 participants |
Back to article view | Back to comp.lang.javascript
click in mp4 Andrew Poulos <ap_prog@hotmail.com> - 2014-12-09 13:31 +1100
Re: click in mp4 "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-12-09 10:03 +0100
Re: click in mp4 Andrew Poulos <ap_prog@hotmail.com> - 2014-12-10 07:38 +1100
Re: click in mp4 "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-12-09 22:57 +0100
Re: click in mp4 Andrew Poulos <ap_prog@hotmail.com> - 2014-12-10 09:36 +1100
Re: click in mp4 "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-12-10 09:59 +0100
Re: click in mp4 Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-12-09 10:51 +0000
Re: click in mp4 Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-12-09 19:29 +0100
Re: click in mp4 Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-12-09 18:50 +0100
Re: click in mp4 Bart Van der Donck <bart@nijlen.com> - 2014-12-10 03:40 -0800
| From | Andrew Poulos <ap_prog@hotmail.com> |
|---|---|
| Date | 2014-12-09 13:31 +1100 |
| Subject | click in mp4 |
| Message-ID | <r8CdnTYAcoC-_RvJnZ2dnUVZ8vWdnZ2d@westnet.com.au> |
Is it possible for an mp4 video that is running natively in a HTML 5 capable browser to pass the coordinates of the cursor when the video is clicked on? I want to use JavaScript to control what "chapters" in a video are played and I don't want "external" buttons. Andrew Poulos
[toc] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2014-12-09 10:03 +0100 |
| Message-ID | <XnsA3FE66655D9A8eejj99@194.109.133.133> |
| In reply to | #26281 |
Andrew Poulos <ap_prog@hotmail.com> wrote on 09 dec 2014 in comp.lang.javascript: > Is it possible for an mp4 video that is running natively in a HTML 5 > capable browser to pass the coordinates of the cursor when the video is > clicked on? You cannot click on an mp4-video as it is a file or a stream, and surely such stream cannot pass coordinates, also as a stream "cursor" has only one dimension. Even if I try to quess what you realy mean, it seems to me that you should read the specs of HTML5 video playing. > I want to use JavaScript to control what "chapters" in a > video are played and I don't want "external" buttons. It is nice to know what you want and don't want, while trying to imagine what "internal" buttons are, but even if that would impact on the top Q, that does not make this top Q an on-topic Q for this NG. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | Andrew Poulos <ap_prog@hotmail.com> |
|---|---|
| Date | 2014-12-10 07:38 +1100 |
| Message-ID | <VaadnUBQ479-wxrJnZ2dnUVZ8i2dnZ2d@westnet.com.au> |
| In reply to | #26287 |
On 9/12/2014 8:03 PM, Evertjan. wrote: > Andrew Poulos <ap_prog@hotmail.com> wrote on 09 dec 2014 in > comp.lang.javascript: > >> Is it possible for an mp4 video that is running natively in a HTML 5 >> capable browser to pass the coordinates of the cursor when the video is >> clicked on? > > You cannot click on an mp4-video as it is a file or a stream, > and surely such stream cannot pass coordinates, > also as a stream "cursor" has only one dimension. > > Even if I try to guess what you really mean, > it seems to me that you should read the specs of HTML5 video playing. > >> I want to use JavaScript to control what "chapters" in a >> video are played and I don't want "external" buttons. > > It is nice to know what you want and don't want, > while trying to imagine what "internal" buttons are, > but even if that would impact on the top Q, > that does not make this top Q an on-topic Q for this NG. > Sorry for being unclear but I didn't know how to word my question any better. I want to be able to click a video and then, depending on what part of the video was clicked, the video would jump to a different part (a chapter). Anyhow my question was answered and I'm now looking into using event listeners with the video element. Andrew Poulos
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2014-12-09 22:57 +0100 |
| Message-ID | <XnsA3FEE975D7BBEeejj99@194.109.133.133> |
| In reply to | #26295 |
Andrew Poulos <ap_prog@hotmail.com> wrote on 09 dec 2014 in comp.lang.javascript: > On 9/12/2014 8:03 PM, Evertjan. wrote: >> Andrew Poulos <ap_prog@hotmail.com> wrote on 09 dec 2014 in >> comp.lang.javascript: >> >>> Is it possible for an mp4 video that is running natively in a HTML 5 >>> capable browser to pass the coordinates of the cursor when the video is >>> clicked on? >> >> You cannot click on an mp4-video as it is a file or a stream, >> and surely such stream cannot pass coordinates, >> also as a stream "cursor" has only one dimension. >> >> Even if I try to guess what you really mean, >> it seems to me that you should read the specs of HTML5 video playing. >> >>> I want to use JavaScript to control what "chapters" in a >>> video are played and I don't want "external" buttons. >> >> It is nice to know what you want and don't want, >> while trying to imagine what "internal" buttons are, >> but even if that would impact on the top Q, >> that does not make this top Q an on-topic Q for this NG. >> > Sorry for being unclear but I didn't know how to word my question any > better. I want to be able to click a video and then, depending on what > part of the video was clicked, the video would jump to a different part > (a chapter). > > Anyhow my question was answered I doubt that. > and I'm now looking into using event > listeners with the video element. The event-listeners will possibly give you the pixel-coordinates of the mouse[-cursor], is that what you wanted? What do those coordinates have to do with the "chapter" [your word]? -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | Andrew Poulos <ap_prog@hotmail.com> |
|---|---|
| Date | 2014-12-10 09:36 +1100 |
| Message-ID | <qMmdncmelesp5xrJnZ2dnUVZ8gSdnZ2d@westnet.com.au> |
| In reply to | #26298 |
On 10/12/2014 8:57 AM, Evertjan. wrote: > Andrew Poulos <ap_prog@hotmail.com> wrote on 09 dec 2014 in > comp.lang.javascript: > >> On 9/12/2014 8:03 PM, Evertjan. wrote: >>> Andrew Poulos <ap_prog@hotmail.com> wrote on 09 dec 2014 in >>> comp.lang.javascript: >>> >>>> Is it possible for an mp4 video that is running natively in a HTML 5 >>>> capable browser to pass the coordinates of the cursor when the video is >>>> clicked on? >>> >>> You cannot click on an mp4-video as it is a file or a stream, >>> and surely such stream cannot pass coordinates, >>> also as a stream "cursor" has only one dimension. >>> >>> Even if I try to guess what you really mean, >>> it seems to me that you should read the specs of HTML5 video playing. >>> >>>> I want to use JavaScript to control what "chapters" in a >>>> video are played and I don't want "external" buttons. >>> >>> It is nice to know what you want and don't want, >>> while trying to imagine what "internal" buttons are, >>> but even if that would impact on the top Q, >>> that does not make this top Q an on-topic Q for this NG. >>> >> Sorry for being unclear but I didn't know how to word my question any >> better. I want to be able to click a video and then, depending on what >> part of the video was clicked, the video would jump to a different part >> (a chapter). >> >> Anyhow my question was answered > > I doubt that. Well, any response to my question is an answer to it ;-) >> and I'm now looking into using event >> listeners with the video element. > > The event-listeners will possibly give you the pixel-coordinates > of the mouse[-cursor], is that what you wanted? > > What do those coordinates have to do with the "chapter" [your word]? I'd like to be able to click on an area of the video and jump to, and play from, a specific chapter in the video itself. So in effect the controller is itself the video (plus some js). Andrew Poulos
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2014-12-10 09:59 +0100 |
| Message-ID | <XnsA3FF65A9FA1F3eejj99@194.109.133.133> |
| In reply to | #26299 |
Andrew Poulos <ap_prog@hotmail.com> wrote on 09 dec 2014 in comp.lang.javascript: >> What do those coordinates have to do with the "chapter" [your word]? > > I'd like to be able to click on an area of the video and jump to, and > play from, a specific chapter in the video itself. So in effect the > controller is itself the video (plus some js). The last controller that was himself in my storage memory, intelligently designed in 1945 by Rev. Wilbert Vere Awdry as the "Fat Director", in 1948 to my illo tempore bewilderment renamed to to "Fat Controller". Even the he could not get things running during a shower. However I cannot remember ever having clicked on him. So please explain. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2014-12-09 10:51 +0000 |
| Message-ID | <874mt5m6zn.fsf@bsb.me.uk> |
| In reply to | #26281 |
Andrew Poulos <ap_prog@hotmail.com> writes: > Is it possible for an mp4 video that is running natively in a HTML 5 > capable browser to pass the coordinates of the cursor when the video > is clicked on? I want to use JavaScript to control what "chapters" in > a video are played and I don't want "external" buttons. I hope you won't mind my re-wording this. Do you mean you want a client-side function to called, with the mouse position being passed, every time the user clicks on an HTML5 video element? I ask this because it works (as far as I know) the same as for any other element: add an even listener for the element, and it will be called with the event as an argument. -- Ben.
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2014-12-09 19:29 +0100 |
| Message-ID | <2025585.Jv9v2AemPM@PointedEars.de> |
| In reply to | #26288 |
Ben Bacarisse wrote: > […] it works (as far as I know) the same as for any other element: > add an [event] listener for the element, and it will be called with the > event as an argument. If you exclude software that uses MSHTML 8 or earlier, or MSHTML 9 in Compatibility Mode, and similarly outdated software that does not implement W3C DOM Level 2+ Events, then you are almost correct: one would add an event listener _to_ the element *for* an event *type*, and it is a *reference* to an event object that is passed as argument value. AFAIK there is no remotely HTML5-compliant software (in this case: one that supports the “video” element as specified) that does not implement W3C DOM Level 2+ Events. -- PointedEars FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/> Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix> Please do not cc me. / Bitte keine Kopien per E-Mail.
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2014-12-09 18:50 +0100 |
| Message-ID | <6536263.SRYisuT2OD@PointedEars.de> |
| In reply to | #26281 |
Andrew Poulos wrote: > Is it possible for an mp4 video that is running natively in a HTML 5 > capable browser to pass the coordinates of the cursor when the video is > clicked on? No, but the event listener of a _HTML5_ “video” element that displays it can. This is one of the advantages of the “video” element. > I want to use JavaScript to control what "chapters" in a > video are played and I don't want "external" buttons. The better approach is to upload this to YouTube and embed chapter links. Otherwise you need to consider video scaling and time index. -- PointedEars FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/> Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix> Please do not cc me. / Bitte keine Kopien per E-Mail.
[toc] | [prev] | [next] | [standalone]
| From | Bart Van der Donck <bart@nijlen.com> |
|---|---|
| Date | 2014-12-10 03:40 -0800 |
| Message-ID | <64efb37b-5990-47f6-9cca-7414f7f565a7@googlegroups.com> |
| In reply to | #26281 |
Andrew Poulos wrote:
> Is it possible for an mp4 video that is running natively in a
> HTML 5 capable browser to pass the coordinates of the cursor
> when the video is clicked on? I want to use JavaScript to
> control what "chapters" in a video are played and I don't
> want "external" buttons.
Sure, that's possible:
www.dotinternet.be/temp/video.html
A bit of playing around with the x/y values and the seconds should put you on the rails:
--------------------------------------
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Demo</title>
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<h2>Click upper half to play from start,
click bottom half to play from second 4</h2>
<video id="vid1" width="420" height="230" style="cursor: pointer;">
<source src="http://www.w3schools.com/html/mov_bbb.mp4"
type="video/mp4">
<source src="http://www.w3schools.com/html/mov_bbb.ogg"
type="video/ogg">
Your browser does not support HTML5 video.
</video>
<script>
function playsec(sec) {
document.getElementById('vid1').currentTime = sec;
document.getElementById('vid1').play();
}
$("#vid1").click(function(event) {
var x = event.pageX - $("#vid1").offset().left;
var y = event.pageY - $("#vid1").offset().top;
if (y <= 115) playsec(0);
if (y > 115) playsec(4);
});
</script>
</body>
</html>
--------------------------------------
Further reading:
http://api.jquery.com/mousemove/
http://www.w3schools.com/tags/ref_av_dom.asp
Hope this helps,
--
Bart
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web