News for hackers. Stuff that matters.
Re:iPhone 5 web teardown: How Apple compresses video using J... by codeka on Sunday September 16, 2012 @10:56PM (#4531166)
I'm not sure if I should be impressed by this. From a technical standpoint, it seems quite clever and unique, but it also seems like a lot of work just to avoid using a <video> tag.
Re:iPhone 5 web teardown: How Apple compresses video using J... by borplk on Monday September 17, 2012 @12:15AM (#4531309)
Yeah it's weird. My web developer side is impressed by the technical detail that go behind it. But my other web developer side asks why the f*ck should achieving a simple video effect on a web page should be this hard in 2012?

There is a whole pattern of similar things like this in web that is killing me a little bit every day.

Want to center a div on the page? No worries just wrap it in these 5 divs and apply these 20 css properties and you are good to go. Oh btw, IE doesn't like that, you need this.

Honestly I think we developers should stop putting up with crap like this, and accepting the burden of broken technologies using hacks, etc...

If we become less tolerant of crap, there will be less crap. As long as we accept it by using workarounds, etc... there will be more shitty things to come.

Re:iPhone 5 web teardown: How Apple compresses video using J... by ricardobeat on Monday September 17, 2012 @03:22AM (#4531586)
May I present you the flexbox model!

http://www.w3.org/TR/css3-flexbox/

http://www.html5rocks.com/en/tutorials/flexbox/quick/

If you need IE8+ support, there is also display:table and family.

Re:iPhone 5 web teardown: How Apple compresses video using J... by wahnfrieden on Monday September 17, 2012 @12:29AM (#4531330)
CSS's flexible box model will eliminate that issue once it has wider support. There is a solution in the pipeline, it's just a matter of time.

Not the best link, but here's some more recent info: http://css-tricks.com/old-flexbox-and-new-flexbox/

Re:iPhone 5 web teardown: How Apple compresses video using J... by rglover on Monday September 17, 2012 @12:40AM (#4531346)
What's difficult about centering a box? Was that just sarcasm? A couple of approaches:

Margin Auto w/ a fixed width

Absolute 50% w/ negative margins

Text-align center parent w/ inline-block display on children

If it was sarcasm, disregard my stupidity.

Re:iPhone 5 web teardown: How Apple compresses video using J... by borplk on Monday September 17, 2012 @02:43AM (#4531503)
That's still non-intuitive. Just do a search about centering (or X problem in CSS) and see the thousands of threads and questions and corner cases, hacks and exceptions.

The whole thing feels like you are stretching something beyond what it was intended to be used for.

Things like element positioning should be so so simple that if you search about it, you get nothing back because no one had a problem to ask for solutions.

Although I must say I'm not mocking CSS in particular, most web technologies feel this way because they were designed many years ago for a web that was supposed to have simple 'documents' like an article, text and paragraphs and today each component of it is expected to do a lot more.

It's not getting all that much better either because each new version and improvement is building on top of the previous decisions, etc...

Re:iPhone 5 web teardown: How Apple compresses video using J... by rimantas on Monday September 17, 2012 @08:08AM (#4532135)

  > most web technologies feel this way 
Most technologies you don't know feel this way. And the reason—you don't know them.

  > It's not getting all that much better either because each
  > new version and improvement is building on top of the
  > previous decisions
In this case: no.
Re:iPhone 5 web teardown: How Apple compresses video using J... by rglover on Monday September 17, 2012 @09:30AM (#4532435)
If that wasn't intuitive enough, feel free to email me and I'd be glad to teach/walk you through the many unfortunate ways to go about this: [email protected].
Re:iPhone 5 web teardown: How Apple compresses video using J... by scotty79 on Monday September 17, 2012 @03:35AM (#4531609)
Right. Now center it vertically. Also don't make any assumptions (like fixed height, or display: block) about container and the box to be centered.
Re:iPhone 5 web teardown: How Apple compresses video using J... by rimantas on Monday September 17, 2012 @08:28AM (#4532198)
http://cssdeck.com/labs/aqdw0l21/0

Container has fixed dimensions in my example, but it does not matter in this case.

Re:iPhone 5 web teardown: How Apple compresses video using J... by scotty79 on Tuesday September 18, 2012 @02:32AM (#4536689)
If container height is given by percentage you have to wrap it in another div with display: table. And if container is supposed to behave like inline-block you have to wrap it in yet another one. If you need to sprinkle around some margins and paddings (esp. with percentage height) you have to choose boilerplate divs to apply them to carefully.

Btw. your approach is exactly same that we had 10 years ago but with CSS table behavior faking rather than table tag.

Yay. Progress.

Re:iPhone 5 web teardown: How Apple compresses video using J... by shawndumas on Monday September 17, 2012 @09:48AM (#4532522)
removing them matters...
Re:iPhone 5 web teardown: How Apple compresses video using J... by maerek on Monday September 17, 2012 @03:19PM (#4534331)
Centering a box horizontally is simple. The original comment was referring to centering an element _vertically_, which is a much greater PITA.
Re:iPhone 5 web teardown: How Apple compresses video using J... by conradfr on Monday September 17, 2012 @04:50AM (#4531728)
I think I am waiting for simple vertical alignment since CSS1.

It's like variables (yeah I know, LESS / SASS ...).

Re:iPhone 5 web teardown: How Apple compresses video using J... by batista on Monday September 17, 2012 @07:17AM (#4532038)
>Margin Auto w/ a fixed width Absolute 50% w/ negative margins Text-align center parent w/ inline-block display on children

Yes, totally intuitive and logical solutions all of them.

If you have w3c Stockholm syndrome, that is.

E.g "Just absolute 50% it with a negative margin" (oh, yes, and you would have to know the width beforehand).

>If it was sarcasm, disregard my stupidity.

It's not the stupidity, is the willingness to put up with BS convoluted inelegant workarounds for lack of basic, bread and butter, features.

If you value elegant APIs, KISS and DSLs, you should run screaming in the opposite direction in all those three, horrible, horrible, techniques.

W3C first came up with their (broken) model, and then they kludged solutions to use cases with it, instead of starting from the use cases first. That's why we have had the tables before and the need for the flexbox and grid layout now.

Re:iPhone 5 web teardown: How Apple compresses video using J... by rglover on Monday September 17, 2012 @09:27AM (#4532424)
It's not the stupidity, is the willingness to put up with BS convoluted inelegant workarounds for lack of basic, bread and butter, features.

You're right, there is a willingness to put up with it. Mainly because I understand how these solutions work, how to debug them, and make everything nice and peachy. Do I wish things were better? Of course! Who wouldn't?

Re:iPhone 5 web teardown: How Apple compresses video using J... by batista on Monday September 17, 2012 @10:34AM (#4532734)
Well, we're in the same boat then.
Re:iPhone 5 web teardown: How Apple compresses video using J... by TruthElixirX on Monday September 17, 2012 @02:15AM (#4531464)
I think it was a hyperbole, but there really is a lot of dumb shit in web design.
Re:iPhone 5 web teardown: How Apple compresses video using J... by cageface on Monday September 17, 2012 @03:19AM (#4531579)
Android's XML layouts feel a lot like a non-braindead web. There are a lot of similarities really, but simple things like vertically centering an element are as easy as they should be.

Text scaling can be a PITA though.

Re:iPhone 5 web teardown: How Apple compresses video using J... by eckyptang on Monday September 17, 2012 @04:30AM (#4531695)
Same with XAML/WPF on Windows platforms which is very refreshing if you've been building for the web for years.
Re:iPhone 5 web teardown: How Apple compresses video using J... by cageface on Monday September 17, 2012 @07:07AM (#4532015)
Yeah I've dabbled just a bit with these and they seem like a nice way to build UIs, also making data binding a lot cleaner than on the web or in the various mobile SDKs.

Honestly I think Microsoft has the best developer toolkit in the business right now but they haven't yet had the product design prowess to put that technology in the consumer's hands in any significant numbers.

Re:iPhone 5 web teardown: How Apple compresses video using J... by daeken on Sunday September 16, 2012 @10:59PM (#4531173)
As noted in the post, iOS devices will only do video tags fullscreen.
Re:iPhone 5 web teardown: How Apple compresses video using J... by jonny_eh on Sunday September 16, 2012 @11:33PM (#4531225)
Seems like a lot of work to workaround a drawback in their own browser.
Re:iPhone 5 web teardown: How Apple compresses video using J... by codeka on Sunday September 16, 2012 @11:07PM (#4531181)
I just tried on my friend's iPod and the animation doesn't play there anyway (it just stays on the "lock" image). Maybe the iPod browser is different (my Android doesn't play the animation either) but I'd be surprised if the animation worked on an iPhone but not on an iPod...
Re:iPhone 5 web teardown: How Apple compresses video using J... by dbloom on Sunday September 16, 2012 @11:13PM (#4531192)
It definitely works on iPhone (I've tried on my 4S and on Simulator).

Apple's JS disables the animation for iOS 4.x and below, so maybe that's why it wasn't playing on your friend's iPod.

Re:iPhone 5 web teardown: How Apple compresses video using J... by josteink on Monday September 17, 2012 @02:27AM (#4531481)
> Apple's JS disables the animation for iOS 4.x and below, so maybe that's why it wasn't playing on your friend's iPod.

I see Apple is really embracing the idea of "the one web" here, introducing web-fragmentation even among their own devices.

Apple has long stopped impressing me. Back in the days when they were the clear underdogs, they were for web-standards and a unified web, because they saw how that was good, and that was what allowed them to become what they are now.

Now it seems they don't really have so much ideological issues with how web-pages should be built anymore. Funny thing that.

Re:iPhone 5 web teardown: How Apple compresses video using J... by culturestate on Monday September 17, 2012 @03:26AM (#4531593)
There's nothing non-standards compliant about what they've done, as far as I can tell. Disabling the animation seems like an attempt at ensuring graceful degradation.
Re:iPhone 5 web teardown: How Apple compresses video using J... by no_more_death on Monday September 17, 2012 @05:01AM (#4531743)
Graceful degradation shouldn't be based on user agent sniffing. That defeats the purpose.
Re:iPhone 5 web teardown: How Apple compresses video using J... by culturestate on Monday September 17, 2012 @10:29AM (#4532710)
I would argue that any reasonable technique that allows users of older browsers to access your site or use your app relatively normally is within the bounds of what we would describe as "graceful degradation." Being non-automatic doesn't make it any less valid.
Re:iPhone 5 web teardown: How Apple compresses video using J... by dtorres on Sunday September 16, 2012 @11:08PM (#4531184)
that is only true for iPhone and iPod touch, you can have inline video on the iPad.
Re:iPhone 5 web teardown: How Apple compresses video using J... by justincormack on Monday September 17, 2012 @08:11AM (#4532143)
And in iAds on the phone...
Re:iPhone 5 web teardown: How Apple compresses video using J... by johnx123-up on Monday September 17, 2012 @03:50AM (#4531632)
Anybody knows, why can't we use GIF instead?
Re:iPhone 5 web teardown: How Apple compresses video using J... by codeka on Monday September 17, 2012 @04:46AM (#4531725)
You probably could, but given that GIF files are limited to a 256-colour palette, it would probably look pretty horrible. Especially for such a large image.
Re:iPhone 5 web teardown: How Apple compresses video using J... by eliaskg on Monday September 17, 2012 @08:02AM (#4532122)
Also you would end up having varying frame rates in different browsers.