Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #16060 > unrolled thread

jQuery to javascript

Started byj <mung_me@att.net>
First post2012-09-20 15:04 -0400
Last post2012-09-20 17:51 -0700
Articles 3 — 3 participants

Back to article view | Back to comp.lang.javascript


Contents

  jQuery to javascript j <mung_me@att.net> - 2012-09-20 15:04 -0400
    Re: jQuery to javascript JJ <jaejunks_at@_googlemail_dot._com> - 2012-09-20 23:11 +0000
    Re: jQuery to javascript David Mark <dmark.cinsoft@gmail.com> - 2012-09-20 17:51 -0700

#16060 — jQuery to javascript

Fromj <mung_me@att.net>
Date2012-09-20 15:04 -0400
SubjectjQuery to javascript
Message-ID<k3fpb1$qor$1@news.albasani.net>
I'm not a jQuery user.

I've been trying to use the mediaelement.js library for HTML5 
audio/video elements which includes silverlight/flash fallbacks for 
noncompliant browsers (IE < 10).

The docs are confusing and all I really can find are examples using 
jQuery,like this:


$('video').mediaelementplayer({
	success: function(media, node, player) {
		var events = ['loadstart', 'play','pause', 'ended'];
		
		for (var i=0, il=events.length; i<il; i++) {
			
			var eventName = events[i];
			
			media.addEventListener(events[i], function(e) {
				$('#output').append( $('<div>' + e.type + '</div>') );
...

$('#output') must be document.getElementById('output')

I'm unsure of $('video'),an object?

And this: $('<div>' + e.type + '</div>') loses me completely.

So, I'd like to know one or more several things.

What does that jQuery mean? Is there audio/video player with IE fallback 
support that is better? Where the hell is the API/method list for 
mediaelement.js

[toc] | [next] | [standalone]


#16065

FromJJ <jaejunks_at@_googlemail_dot._com>
Date2012-09-20 23:11 +0000
Message-ID<XnsA0D53F7CF1499jaejunksgooglemailco@0.0.0.89>
In reply to#16060
j <mung_me@att.net> wrote:

> I'm not a jQuery user.
> 
> I've been trying to use the mediaelement.js library for HTML5 
> audio/video elements which includes silverlight/flash fallbacks for 
> noncompliant browsers (IE < 10).
> 
> The docs are confusing and all I really can find are examples using 
> jQuery,like this:
> 
> 
> $('video').mediaelementplayer({
>      success: function(media, node, player) {
>           var events = ['loadstart', 'play','pause', 'ended'];
>           
>           for (var i=0, il=events.length; i<il; i++) {
>                
>                var eventName = events[i];
>                
>                media.addEventListener(events[i], function(e) {
>                     $('#output').append( $('<div>' + e.type +
>                     '</div>') ); 
> ...
> 
> $('#output') must be document.getElementById('output')
> 
> I'm unsure of $('video'),an object?
> 
> And this: $('<div>' + e.type + '</div>') loses me completely.
> 
> So, I'd like to know one or more several things.
> 
> What does that jQuery mean? Is there audio/video player with IE
> fallback support that is better? Where the hell is the API/method list
> for mediaelement.js

Hint: Look at the mediaelement.js source code.

[toc] | [prev] | [next] | [standalone]


#16071

FromDavid Mark <dmark.cinsoft@gmail.com>
Date2012-09-20 17:51 -0700
Message-ID<91cafb59-f5f9-431f-9f67-b51808bc28ab@m9g2000yqi.googlegroups.com>
In reply to#16060
On Sep 20, 3:04 pm, j <mung...@att.net> wrote:
> I'm not a jQuery user.

Good for you. :)

>
> I've been trying to use the mediaelement.js library for HTML5
> audio/video elements which includes silverlight/flash fallbacks for
> noncompliant browsers (IE < 10).

Okay.

>
> The docs are confusing and all I really can find are examples using
> jQuery,like this:
>
> $('video').mediaelementplayer({
>         success: function(media, node, player) {
>                 var events = ['loadstart', 'play','pause', 'ended'];
>
>                 for (var i=0, il=events.length; i<il; i++) {
>
>                         var eventName = events[i];
>
>                         media.addEventListener(events[i], function(e) {
>                                 $('#output').append( $('<div>' + e.type + '</div>') );
> ...
>
> $('#output') must be document.getElementById('output')

The "$" function doesn't return references to elements, but that
example will wrap the same result.

>
> I'm unsure of $('video'),an object?

All VIDEO elements in the document, which won't actually play video in
some browsers.

>
> And this: $('<div>' + e.type + '</div>') loses me completely.

They are logging the event type for some reason. Debugging I imagine.

>
> So, I'd like to know one or more several things.

I imagine so.

>
> What does that jQuery mean?

The script apparently installs itself as a jQuery plug-in. I can only
guess that "success" means it passed its feature detection and
references a callback function, which has been cropped. The part that
is visible starts a loop that attaches four event listeners to...
something, but can't tell if it is using the addEventListener host
method or some method of the player script's API. As has been
mentioned, would have to look at the code (or the documentation if it
exists).

> Is there audio/video player with IE fallback
> support that is better?

I have no idea whether that player script is any good or not (would
have to dig up its code). I use a 2 or 3 dozen line script to add
HTML5 or Flash video enhancements, but depending on the context, a
script is not always necessary. I'm fuzzy on the details as I haven't
had a request for that recently.

> Where the hell is the API/method list for
> mediaelement.js

How should I know? Ask the person who wrote it (assuming *they*
exist). ;)

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web