• »
  • Apple
  • » 為何iPhone,iPod,iPad不支援Flash,HTML5將更普及於網路世界!!
    上一篇:

    為何iPhone,iPod,iPad不支援Flash,HTML5將更普及於網路世界!!

    先解釋一下本文會用到的一些專有名詞,Flash影片,這個名詞大家應該都不陌生,因為網路上有75%的影片都是Flash,也就是我們常見的FLV檔,如果你曾嘗試下載過YouTube的影片,你應該知道(不過最近都是.mp4),遇到這一種影片格式的時候,你的瀏覽器,就需要Flash Player囉。

    然而,這就是問題所在,為何蘋果的行動裝置(Mobile),就是偏偏不支援Flash播放呢??如果你是剛接觸Apple的Mobile裝置 時,你可能不清楚,或許不知道,只知道在逛一些網站時,一些動畫、影片跑不出來…那是為什麼??為什麼偏偏Apple的跑不出來??

    追根究柢,就是因為Adobe對於Flash的處理方式,賈伯斯(Steve Jobs),曾於2010年4月時發布一篇關於Flash的文章,如下(中譯):

    Thoughts on Flash:

    Apple has a long relationship with Adobe. In fact, we met Adobe’s founders when they were in their proverbial garage. Apple was their first big customer, adopting their Postscript language for our new Laserwriter printer. Apple invested in Adobe and owned around 20% of the company for many years. The two companies worked closely together to pioneer desktop publishing and there were many good times. Since that golden era, the companies have grown apart. Apple went through its near death experience, and Adobe was drawn to the corporate market with their Acrobat products. Today the two companies still work together to serve their joint creative customers – Mac users buy around half of Adobe’s Creative Suite products – but beyond that there are few joint interests.

    I wanted to jot down some of our thoughts on Adobe’s Flash products so that customers and critics may better understand why we do not allow Flash on iPhones, iPods and iPads. Adobe has characterized our decision as being primarily business driven – they say we want to protect our App Store – but in reality it is based on technology issues. Adobe claims that we are a closed system, and that Flash is open, but in fact the opposite is true. Let me explain.

    First, there’s “Open”.

    Adobe’s Flash products are 100% proprietary. They are only available from Adobe, and Adobe has sole authority as to their future enhancement, pricing, etc. While Adobe’s Flash products are widely available, this does not mean they are open, since they are controlled entirely by Adobe and available only from Adobe. By almost any definition, Flash is a closed system.

    Apple has many proprietary products too. Though the operating system for the iPhone, iPod and iPad is proprietary, we strongly believe that all standards pertaining to the web should be open. Rather than use Flash, Apple has adopted HTML5, CSS and JavaScript – all open standards. Apple’s mobile devices all ship with high performance, low power implementations of these open standards. HTML5, the new web standard that has been adopted by Apple, Google and many others, lets web developers create advanced graphics, typography, animations and transitions without relying on third party browser plug-ins (like Flash). HTML5 is completely open and controlled by a standards committee, of which Apple is a member.

    Apple even creates open standards for the web. For example, Apple began with a small open source project and created WebKit, a complete open-source HTML5 rendering engine that is the heart of the Safari web browser used in all our products. WebKit has been widely adopted. Google uses it for Android’s browser, Palm uses it, Nokia uses it, and RIM (Blackberry) has announced they will use it too. Almost every smartphone web browser other than Microsoft’s uses WebKit. By making its WebKit technology open, Apple has set the standard for mobile web browsers.

    Second, there’s the “full web”.

    Adobe has repeatedly said that Apple mobile devices cannot access “the full web” because 75% of video on the web is in Flash. What they don’t say is that almost all this video is also available in a more modern format, H.264, and viewable on iPhones, iPods and iPads. YouTube, with an estimated 40% of the web’s video, shines in an app bundled on all Apple mobile devices, with the iPad offering perhaps the best YouTube discovery and viewing experience ever. Add to this video from Vimeo, Netflix, Facebook, ABC, CBS, CNN, MSNBC, Fox News, ESPN, NPR, Time, The New York Times, The Wall Street Journal, Sports Illustrated, People, National Geographic, and many, many others. iPhone, iPod and iPad users aren’t missing much video.

    Another Adobe claim is that Apple devices cannot play Flash games. This is true. Fortunately, there are over 50,000 games and entertainment titles on the App Store, and many of them are free. There are more games and entertainment titles available for iPhone, iPod and iPad than for any other platform in the world.

    Third, there’s reliability, security and performance.

    Symantec recently highlighted Flash for having one of the worst security records in 2009. We also know first hand that Flash is the number one reason Macs crash. We have been working with Adobe to fix these problems, but they have persisted for several years now. We don’t want to reduce the reliability and security of our iPhones, iPods and iPads by adding Flash.

    In addition, Flash has not performed well on mobile devices. We have routinely asked Adobe to show us Flash performing well on a mobile device, any mobile device, for a few years now. We have never seen it. Adobe publicly said that Flash would ship on a smartphone in early 2009, then the second half of 2009, then the first half of 2010, and now they say the second half of 2010. We think it will eventually ship, but we’re glad we didn’t hold our breath. Who knows how it will perform?

    Fourth, there’s battery life.

    To achieve long battery life when playing video, mobile devices must decode the video in hardware; decoding it in software uses too much power. Many of the chips used in modern mobile devices contain a decoder called H.264 – an industry standard that is used in every Blu-ray DVD player and has been adopted by Apple, Google (YouTube), Vimeo, Netflix and many other companies.

    Although Flash has recently added support for H.264, the video on almost all Flash websites currently requires an older generation decoder that is not implemented in mobile chips and must be run in software. The difference is striking: on an iPhone, for example, H.264 videos play for up to 10 hours, while videos decoded in software play for less than 5 hours before the battery is fully drained.

    When websites re-encode their videos using H.264, they can offer them without using Flash at all. They play perfectly in browsers like Apple’s Safari and Google’s Chrome without any plugins whatsoever, and look great on iPhones, iPods and iPads.

    Fifth, there’s Touch.

    Flash was designed for PCs using mice, not for touch screens using fingers. For example, many Flash websites rely on “rollovers”, which pop up menus or other elements when the mouse arrow hovers over a specific spot. Apple’s revolutionary multi-touch interface doesn’t use a mouse, and there is no concept of a rollover. Most Flash websites will need to be rewritten to support touch-based devices. If developers need to rewrite their Flash websites, why not use modern technologies like HTML5, CSS and JavaScript?

    Even if iPhones, iPods and iPads ran Flash, it would not solve the problem that most Flash websites need to be rewritten to support touch-based devices.

    Sixth, the most important reason.

    Besides the fact that Flash is closed and proprietary, has major technical drawbacks, and doesn’t support touch based devices, there is an even more important reason we do not allow Flash on iPhones, iPods and iPads. We have discussed the downsides of using Flash to play video and interactive content from websites, but Adobe also wants developers to adopt Flash to create apps that run on our mobile devices.

    We know from painful experience that letting a third party layer of software come between the platform and the developer ultimately results in sub-standard apps and hinders the enhancement and progress of the platform. If developers grow dependent on third party development libraries and tools, they can only take advantage of platform enhancements if and when the third party chooses to adopt the new features. We cannot be at the mercy of a third party deciding if and when they will make our enhancements available to our developers.

    This becomes even worse if the third party is supplying a cross platform development tool. The third party may not adopt enhancements from one platform unless they are available on all of their supported platforms. Hence developers only have access to the lowest common denominator set of features. Again, we cannot accept an outcome where developers are blocked from using our innovations and enhancements because they are not available on our competitor’s platforms.

    Flash is a cross platform development tool. It is not Adobe’s goal to help developers write the best iPhone, iPod and iPad apps. It is their goal to help developers write cross platform apps. And Adobe has been painfully slow to adopt enhancements to Apple’s platforms. For example, although Mac OS X has been shipping for almost 10 years now, Adobe just adopted it fully (Cocoa) two weeks ago when they shipped CS5. Adobe was the last major third party developer to fully adopt Mac OS X.

    Our motivation is simple – we want to provide the most advanced and innovative platform to our developers, and we want them to stand directly on the shoulders of this platform and create the best apps the world has ever seen. We want to continually enhance the platform so developers can create even more amazing, powerful, fun and useful applications. Everyone wins – we sell more devices because we have the best apps, developers reach a wider and wider audience and customer base, and users are continually delighted by the best and broadest selection of apps on any platform.

    Conclusions.

    Flash was created during the PC era – for PCs and mice. Flash is a successful business for Adobe, and we can understand why they want to push it beyond PCs. But the mobile era is about low power devices, touch interfaces and open web standards – all areas where Flash falls short.

    The avalanche of media outlets offering their content for Apple’s mobile devices demonstrates that Flash is no longer necessary to watch video or consume any kind of web content. And the 250,000 apps on Apple’s App Store proves that Flash isn’t necessary for tens of thousands of developers to create graphically rich applications, including games.

    New open standards created in the mobile era, such as HTML5, will win on mobile devices (and PCs too). Perhaps Adobe should focus more on creating great HTML5 tools for the future, and less on criticizing Apple for leaving the past behind.

    Steve Jobs
    April, 2010

    html5-apple

    簡單來說,賈伯斯對於Flash,有五個重點,第一,是「開放」;其次,是「完整的網路體驗」;再者,是「穩定性、安全與效能」;第四,是「電池的續航力」;第五,是「觸控」。因為Flash的系統只能從Adobe更新、取得檔案來源,這就與iOS的理念不符,因為蘋果真對Mobile產品所開發的iOS作業系統,是封閉的然而,Flash也是封閉的,但卻是另一種形式的封閉,但倘若要讓這些iPhone,iPod,iPad支援Flash,兩者卻又不能同時封閉,因此,在Adobe、Apple互不相讓的情況下,你就會發現,Apple的Mobile產品沒法執行、播放Flash的動畫及影片。

    又,蘋果主打「輕、久、觸」幾樣人性化的功能,為了避免Flash占用記憶體空間,使Apple更不允許Flash在iOS系統上執行。Flash是為了讓配備滑鼠的個人電腦操作而設計,而並非為使用手指操作的觸控螢幕打造。例如,許多Flash網站依賴”滑鼠移過(Rollover)”控制,像是跳出式選單以及其他元素,必須將滑鼠移到某個特定位置才會出現。Apple革命性的多點觸控介面不需要滑鼠,也沒有”滑鼠移過(Rollover)”的概念。大多數的Flash網站需要重新寫過以支援觸控設備。如果開發者們必須重寫他們的Flash網站,那為什麼不使用先進的技術,像是HTML5、CSS以及JavaScript呢?

    如何讓影片不受Flash所束縛??

    h.264

    H.264影片編碼是一種可適用於多種影片格式,如MOV、FLV檔。而目前在YouTube等各大網路影音上的FLV檔,多採用H.264作為編碼,所以它們既是Flash,又是H.264。

    • Flash:YouTube上的FLV影片得透過一個SWF(Shockwave Flash)播放器播放,而這個播放器會呼叫Flash Player Plug-In來播放影片。
    • HTML5:YouTube上的M4V影片直接利用<Video>標籤即可透過播放,而播放器是以JavaScript寫成,一切都以瀏覽器內建功能完成。

    HTML5可以播影片??

    這是一個錯誤的觀念,如果你認為如此,請看看下面的介紹。事實上,HTML5是不能播影片的,他是利用網頁裡和瀏覽器所搭載的CSS與Java所做到效果,先是利用HTML5「語意標籤」中的<video>,去執行。而現在所做出來的瀏覽器大多數都支援HTML5,H.264是可以不碰到Flash的一種編碼,而H.264是目前iPad/iPhone/iPod上唯一支援的編碼格式、也是大多數數位相機、攝影機所拍攝出來的格式。

    Safari、Chrome

    要使用H.264作為影片播放,首先我們當然得先取得H.264的檔案,誠如前面所提及的,若是你是從手機、攝影機或照相機等裝置拍攝影片,那大多數的影片便是H.264格式。而若是其他來源的影片,則可以參考網路上眾多的轉檔教學先行進行轉檔。

    在HTML5中的影片播放均得透過語意標籤,其架構大約如下:

    <video width="640" height="480" poster="file.jpg" controls>
     <source src="https://~~/file.mp4" type="video/mp4"></source>
    </video>

    我們可以看到在<video>標籤中存在著許多不同的屬性,如下:

    • width與height – 長寬
    • poster – 影片播放前的預覽圖
    • controls – 開啟影片控制功能、像是快轉等
    • autoplay – 自動播放

    而下方的<source>標籤自然就是記載你影片檔案所存放的路徑,這樣就能正常使用了!

    Firefox、Opera

    筆者前一篇談HTML5影片播放的文章曾經提過,由於H.264並非免費開放的授權,故Firefox/Opera雖然支援HTML5影片播放,但source並不能使用H.264作為影片的格式、而是使用OGG作為影片格式。

    聰明的讀者可能已經注意到,在HTML5中的標籤中含有可以指定影片來源,所以我們只需要在H.264的後在新增一個OGG的影片來源就可以了!

    因此程式碼變成如下:

    <video width="640" height="480" poster="file.jpg" controls>
    <source src="https://~~/file.mp4" type="video/mp4"></source>
    <source src="https://~~/file.ogg" type="video/ogg"></source>
    </video>

    這樣一來,當使用者使用iPad/iPhone或是其他各種支援H.264的瀏覽裝置讀到這段程式碼時,便會優先使用H.264格式的檔案,若是使用的瀏覽器無法讀取時,則會跳到下一則<source>所提供的ogg格式檔案作為播放。

    Internet Explorer 8以下與其他
    但若是遇到完全不支援HTML5的瀏覽器時又該怎麼辦?別擔心,我們可以在<video>標籤內的最後放入無法播放影片時的替代選項,像是顯示影片下載連結、或是提示使用者更換瀏覽器播放,或者是使用Flash作為最後的播放選擇。

    透過加入Flash的支援,便可以幾乎確保所有瀏覽裝置用最佳的影片播放方案。程式碼如下:

    <video width="640" height="480" poster="file.jpg" controls>
    <source src="https://~~/file.mp4" type="video/mp4"></source>
    <source src="https://~~/file.ogv" type="video/ogg"></source>
    <object width="640" height="480" type="application/x-shockwave-flash" data="_DO-YOUR-FLASH-EMBEDED">
    </object>
    </video>

    在 <object>中,你可以如同一般的Flash嵌入一般的自由設定、加入<parms>標籤。或者是你也可以直接加入YouTube、Vimeo等外嵌程式片段。

    Advertisement
    Follow US
    About Post
    Date: 2012.01.27 Tags: , , , , , ,
    Discussion - 4 Comments
    1. Jenny

      不過這也有他的好處@@

      TWweeb :
      恩~其實也不會太不方便

    Leave a Reply