Re: <video> toggling video rendering

On Tue, 23 Jun 2009 06:27:22 -0400, Robin Berjon <robin@berjon.com> wrote:

> On Jun 23, 2009, at 11:40 , Michael A. Puls II wrote:
>>> or use <audio>, and then the browser can optimize away the video  
>>> decoding.
>>
>> Yes, I see that this works. But, that seems more complicated to switch  
>> between <video> and <audio> to get the effect.
>
> It's not that complicated really, and semantically it does make more  
> sense. What's more with the toggled off <video> you'd have to specify  
> what to do if it's passed to drawImage() or createPattern(), and neither  
> option (decoding offscreen to be ready when asked even though nothing is  
> shown, or returning nothing) is all that elegant. The same applies to  
> controls, what width and height would be, etc.

O.K., I see. Have <audio> and <video> play the same src file with <video>  
set to autoplay for example and <audio> not.

Then, do like this:

function toggleVideoOutput() {
     if (video.paused === true) {
         audio.pause();
         video.currentTime = audio.currentTime;
         video.play();
     } else {
         video.pause();
         audio.currentTime = video.currentTime;
         audio.play();
     }
}

or something.

-- 
Michael

Received on Tuesday, 23 June 2009 10:44:02 UTC