 |
|
 |
|
 |
 |
|
|
|
|
|
|
| flash player 9 가 발표된지도 1년이 훌쩍 지난 시점이지만 정식으로 flash CS 가 발표된지 얼마 지나지 않았기 때문에 아직까지는 개발자들의 as3.0 사용빈도도 적을뿐더러 사용자들의 pc 에 설치되어있는 flash player 버전이 8.0 이하 버전들도 상당수 존재한다. flash player 보급률 통계(adobe flash player penetration)에 따르면 현재(2007.3) 80% 정도로 배포되어있다. 물론 상당한 배포율이지만 소수의 사용자들을 고려한다면 원하는 컨텐츠를 사용자에게 보여주지 못하는 정도가 무시못할 수치이다.
이렇듯 새로운 버전의 flash player가 발표될때 마다 개발자들은 사용자들이 가지고 있는 flash player 버전을 고려하여 개발을 하고 그것에 맞는 flash player 가 설치 되어있는지의 여부를 체크해야만 한다. 그렇지 않다면 하위버전의 flash player 를 가졌거나 아예 없는 사용자가 사이트를 방문했을 시 영문도 모른 채 빈 화면만 보게 될 것이다.
이전에도 이런 문제를 해결하기 위해 많은 노력이 있었지만 아직 100% 완벽하게 처리할 수 없는 점이 존재한다. 개개인 사용자들의 브라우저 보안설정이나 운영체제의 상이함으로 인해 똑같은 결과를 얻지 못하는 경우가 종종 발생한다.
이글에서는 기존의 방법들중에서 가장 사용하기 편하면서 널리 이용되고 있는 SWFObject 라는 flash embed script 를 이용하여 player 버전체크 뿐만아니라 직접 install 하는 과정을 소개한다.
우선 flash player detection 과정은 크게 3단계로 구분된다.
첫째, 브라우저에서 javascript 사용가능 체크. 둘째, flash player 설치여부. 셋째, flash player 버전 체크.
몇몇 일부 사용자들은 브라우저의 javascript 기능을 꺼놓은 경우가 있다. 이럴경우 javascript 를 사용하여 flash detection 을 하는 과정이나 html에 swf 파일을 임베드 하는 과정이 전혀 작동하지 않게 된다. 따라서 가장 먼저 사용자 브라우저의 javascript 기능의 활성화 여부를 체크해야만 한다. 이 단계에서는 간단히 <noscript></noscript> 이용하여 대체 메시지를 출력하여 처리하면 된다.
player 설치 체크와 버전 체크는 SWFObject 에서 처리해 준다. 또한 window 뿐만 아니라 mac 의 주요 웹 브라우저의 flash plugin 감지도 지원해준다. 실제 mac 용 브라우저인 safari, opera 등에서도 문제없이 작동되었다. 자세한 SWFObject 사용법은 이전 포스트 나 아래 관련 링크를 참고하면 된다.
<html code>
<script type="text/javascript" src="swfobject.js"></script> <body> <div id="flashcontent"> <script> document.write("This content requires the Adobe Flash Player 9<a href=http://www.adobe.com/go/getflash/>Get Flash</a>"); </script> </div> <script type="text/javascript"> var so = new SWFObject("example.swf", "example", "600", "200", "9", "#ffffff"); so.useExpressInstall('expressinstall.swf'); so.write("flashcontent"); </script> <noscript> This content requires a browser with JavaScript enabled. </noscript> </body>
위 코드는 flash embed 코드이다. SWFObject 에서는 요구하는 버전이 아니거나 존재하는 않을경우 flash 페이지를 대신할 수 있는 div tag 를 제공하는데 이곳에 대체 텍스트나 이미지를 넣어 사용자에게 상황에 맞는 적절한 정보를 제공할 수 있다. 그리고 하단부분에 noscript 태그가 존재하는데 이는 javascript 를 쓸수 없을 경우 실행되는 부분이다. 지금까지는 단순히 적절한 flash player 가 설치되어있는지의 여부를 판단하고 그에 대한 정보를 제공하는 것이 전부였다. 위 코드에 걸리는 사용자는 아마 제공하는 컨텐츠보다 player 버전이 낮을 경우가 대부분일 것이다. 즉, 사이트를 볼수 없는 사용자들 중에는 자바스크립트를 비활성으로 하거나 player 가 아예 설치되어있지 않을 경우보다 설치되어있는 player 의 하위버전으로 인한 문제가 대부분이다. 따라서 좀더 친숙하게 사용자에게 접근하려면 버전체크로 끝나는 것이 아니라 설치까지도 제공해 줄 필요가 있다.
이를 위해 Adobe 에서는 Express Install 을 제공해준다. 이는 플래시 파일내에서 직접 flash player 업그레이드를 진행해 주는 것이다.
SWFObject 에서도 Express Install 을 사용할 수 있게 메소드를 제공해 준다. so.useExpressInstall('expressinstall.swf');
위와 같이 사용하면 expressinstall.swf 가 업그레이드를 진행하는 부분으로 반드시 player 버전이 6.0.65 이상으로 작업되어야 한다. 만약 flash player 버전이 9.0 보다 낮을경우 아래와 같은 화면이 보일것이다.
 첨부 파일을 확인하면 원하는 형태로 디자인을 변경하여 업그레이드를 진행할 수 있다. 단, express install 을 사용하려면 Adobe 에서 제공하는 업그레이드 과정에서 생성되는 메시지 창의 크기때문에 최소 214*137 px 로 제작해야한다.
express install test (반드시 flash player 를 제거하고 8.0 버전을 설치한후 테스트)
download sample.....
<Installer and UnInstaller> Window version. Mac version.
<Related articles> Best Practices for Flash Player Detection Using Express Install with SWFObject
|
|
| 이 글의 관련글(트랙백) 주소 :: http://kimkijeung.com/trackback/99 |
|
|
|
|
|
|
|
There have been numerous posts about frame rate issues in Flash over the years, sometimes with quite inconsistent tips and workarounds. As we are approaching the final phase of development for Flash Player 9 at Adobe our bug database is filling up with duplicate bugs concerning old known issues. What is frustrating to designers is that they perceive the Flash Player changing its behavior over the past few releases, although it has not. Well, that might actually be the problem.
Flash uses a relative timing model, meaning it does not really care about a global frame rate, but will instead try to enforce frame intervals as best as it can. Say you have f.ex. set your frame rate to 30 frames/sec. That means that the Flash Player will try to wait for 33 milliseconds before trying to display the next frame (excluding the time it takes to render the frame). This loose timing causes all kinds of problems. First, the Flash Player depends on high level OS events to deliver timing messages. In the worst case this means the use of WM_TIMER, dependence on the NetScape plugin API or in the best case we use multimedia timers provided by a special Internet Explorer API. Second, we round frame intervals to milliseconds since Windows and MacOS can't support fractional time intervals. Third, the OS, the browser and the Flash Player will add overhead to the code executed on each frame, meaning that in the end the actual frame rate will sway between -10 to +5 frames/sec from the actual selected frame rate, depending in what environment you play it in. In Flash Player 8 and Flash Player 9 new overhead is originating mostly from the GC, something for which there is no workaround. As I said we do not calculate frame rates on a global basis so we can't correct it actively.
Lets talk about maximum frame rates. In Internet Explorer this is 100 frames/sec. Why? Because the minimum time slice Windows timers can provide is 10 milliseconds. What about FireFox? FireFox does not use special timers and made a decision to limit the maximum frame rate for plugins. Why? The thinking is that users constantly complain that plugins take too much CPU time. A valid complaint I think and every designer who puts online ads out there at higher than 8-12 frames/sec and more that 2 or 3% CPU usage should be ashamed. While a single ad will not be a problem, most pages easily serve 2 or 3 ads on a single page.
The Mozilla team also decided that plugins would get no time when they are on a hidden tab so it would not render the browser unresponsive or less responsive by adding new tabs. So do not be surprised if your SWFs and FLVs do no play on hidden tabs. Apple went even a step further in Safari: If the browser is not active, plugins will only get about 4 frames/sec, mainly to save battery and avoid the dreaded noise of the fans. Try it, go to Google Video, play a video and then switch to another application. The frame rate will drop to about 4 frames/sec. While we could drive our own background thread and work around this, there is a reason they decided to take these steps. We would be ill advised to just hack around it.
What does this mean? Well, the frame rate you select does not really mean too much and you should not depend on it in a way to be accurate to the millisecond. This especially goes for ANY sort of synchronization. If you need synchronization your only choice is placing code in ActionScript which will 'correct' your timing or workarounds like placing a streaming sound on your main time line (In which case we use the audio device to report time correctly to the nanosecond. Due to bugs this does not work correctly on Linux right now, which is the reason audio and video are out of sync, even for FLVs :-( )
What does the future hold? As I explained in a earlier post we will likely add synchronization primitives into the player to allow SMILE like global timing at some point. But there is also a good chance we'll limit what users can actually do when it comes to frame rates and overall CPU usage. There are various ways we could enforce low CPU usage. SWF files originating from a different domain (speaking advertisement) could get a lower priority and have a frame rate cap which would be user selectable. Secondly, with the advent of GPU support in the OS there will be a time when we finally add VBL wait, meaning tearing free drawing. In most cases this means the maximum frame rate will be 60 frames/sec. On high CPU load we might actually cut this into half, e.g. 30 frames/sec. OS X already does this in certain conditions.
firefox 와 safari 에서 유독 flash framerate 가 떨어지는 현상이 있다고 느꼈었는데... 강제로 플러그인에서 막아놓은 결과였다. 무분별한 framerate 의 사용으로 인해 사이트가 느려지고 사용자 컴퓨터가 다운되는 걸 막기 위한 궁여지책이 아닌가 생각든다.
flash player 9 에서는 framerate 0.1 에서 1000까지 지원한다고 나와있지만 과연 어느정도의 성능을 보여줄지..
위에서 언급한 내용대로라면 플레이어 근본을 바꾸지 않는다면 힘들다는 생각이 들지만 AS3 을 기반으로 제작한 flash player 9 의 성능은 AVM2 로 전혀 새로운 머신으로 탈바꿈했다고 하니 한번 기대해 볼만하다.
근데 사운드가 포함된 stream 파일도 200-300 framerate 를 지원할까궁금하다.
|
|
| 이 글의 관련글(트랙백) 주소 :: http://kimkijeung.com/trackback/64 |
|
|
|
|
|
 |
|
|