From emoller at opera.com Tue Jun 1 03:12:54 2010 From: emoller at opera.com (=?iso-8859-15?Q?Erik_M=F6ller?=) Date: Tue, 01 Jun 2010 12:12:54 +0200 Subject: [whatwg] WebSockets: UDP Message-ID: The use case I'd like to address in this post is Real-time client/server games. The majority of the on-line games of today use a client/server model over UDP and we should try to give game developers the tools they require to create browser based games. For many simpler games a TCP based protocol is exactly what's needed but for most real-time games a UDP based protocol is a requirement. Games typically send small updates to its server at 20-30Hz over UDP and can with the help of entity interpolation and if required entity extrapolation cope well with intermittent packet loss. When a packet loss occur in a TCP based protocol the entire stream of data is held up until the packet is resent meaning a game would have to revert to entity extrapolation possibly over several seconds, leading to an unacceptable gameplay experience. It seems to me the WebSocket interface can be easily modified to cope with UDP sockets (a wsd: scheme perhaps?) and it sounds like a good idea to leverage the work already done for WebSockets in terms of interface and framing. The most important distinction between ws: and wsd: is that messages sent by send() in wsd: need not be acknowledged by the peer nor be resent. To keep the interface the same to the largest possible extent I'd suggest implementing a simple reliable 3-way handshake over UDP, keep-alive messages (and timeouts) and reliable close frames. If these are implemented right the interface in it's entirety could be kept. Only one new readonly attribute long maxMessageSize could be introduced to describe the min path MTU (perhaps only valid once in connected mode, or perhaps set to 0 or 576 initially and updated once in connected mode). This attribute could also be useful to expose in ws: and wss: but in that case be set to the internal limit of the browser / server. The actual content of the handshake for wsd: can be vastly simplified compared to that of ws: as there's no need to be http compliant. It could contain just a magic identifier and length encoded strings for origin, location and protocol. To minimize the work needed on the spec the data framing of wsd: can be kept identical to that of ws:, though I'd expect game developers would choose whatever the binary framing will be once the spec is done. I'd be very interested to hear peoples opinion on this. -- Erik M?ller Core Developer Opera Software From svartman95 at gmail.com Tue Jun 1 04:09:57 2010 From: svartman95 at gmail.com (Bjartur Thorlacius) Date: Tue, 1 Jun 2010 11:09:57 +0000 Subject: [whatwg] audio and video: volume and muted as content attributes? In-Reply-To: References: <4c0420c9.d345d80a.5c04.ffffd9f9@mx.google.com> Message-ID: On 5/31/10, Silvia Pfeiffer wrote: > On Tue, Jun 1, 2010 at 6:48 AM, bjartur wrote: >>>I just came across a curious situation in the spec: IIUC, it seems the >>>@volume and @muted attributes are only IDL attributes and not content >>>attributes. This means that an author who is creating an audio-visual >>>Webpage has to use JavaScript to turn down (or up) the loudness of >>>their media elements or mute them rather than just being able to >>>specify this through content attributes. >>>If you want to control the volume for the user after the page loads >>>then yes, you'll need JavaScript. >>>I've searched the archives and didn't find a discussion or reasons for >>>this. Apologies if this has been discussed before. >>> >>>I am guessing the reasons for not having them as content attributes is >>>that anything that requires muting of audio-visual content is assumed >>> to need JavaScript anyway. >> >> Exactly. >> >>>However, if I have multiple videos on a page, all on autoplay, it >>>would be nice to turn off the sound of all of them without JavaScript. >>>With all the new CSS3 functionality, I can, for example, build a >>>spinning cube of video elements that are on autoplay or a marquee of >>>videos on autoplay - all of which would require muting the videos to >>>be bearable. If we added @muted to the content attributes, it would be >>>easy to set the muted state without having to write any JavaScript. >> >> If you need the audio to be muted you should use CSS. If you need to >> control volume dynamically you need scripting. > > I am not aware of a CSS property for media elements that lets you > control the muted state. Can you link me to a specification? Well, http://www.w3.org/TR/CSS2/aural.html defines volume and play-during. Play-during can stop, autoplay and repeat sounds. It's not obvious to me how this will apply to elements that represent audiovisual content but volume: silent; unambiguously mutes content. Decorating audio (such as background music in games or videos) seem to be even more easily styled for some reason. Multiple soundtracks can be muxed and assigned different loudness. Also @media aural {display: none;} can be used on audio elements but I haven't read the specs properly so I don't know if that would hide an