Skip to Content
COCOA學習手冊--使用OBJECTIVE-C第三版
book

COCOA學習手冊--使用OBJECTIVE-C第三版

by Paris Buttfield-Addison, Jonathon Manning
June 2013
Intermediate to advanced
360 pages
6h 50m
Chinese
GoTop Information, Inc.
Content preview from COCOA學習手冊--使用OBJECTIVE-C第三版
音頻與視頻
|
131
AVPlayer
為你的媒體播放擔任控制器的角色,在最簡單的情形下,你只需要叫播放器開
始播放即可︰
[player play];
在背景中,
play
方法實際上只是將播放速率設成 1.0,這表示它應該以正
常速率播放媒體。你也可以透過指明
[player setRate:0.5]
,以 1/2 的速
率開始播放。同樣地,把速率設成 0 會暫停播放—那正是
pause
方法所做
的事情。
AVPlayerLayer
AVPlayer
只負責協調播放,而不是向使用者展示視頻內容。如果你想要視頻播放被看
見,還需要一個 Core Animation 分層(layer),以便在上面顯示播放內容。
AV Foundation 提供名為
AVPlayerLayer
Core Animation 分層,呈現來自
AVPlayer
視頻內容。因為它是
CALayer
,你必須將它增加到既有的分層樹(layer tree),好讓它被
看見。稍後在本章中,我們會簡明扼要地重述如何操作分層。
使用
playerLayerWithPlayer:
方法建立
AVPlayerLayer
AVPlayerLayer* playerLayer = [AVPlayerLayer playerLayerWithPlayer:player];
(是的,聽起來就像在繞口令。)
一旦建立完成,播放器分層將展示你所提供之
AVPlayer
叫它播放的任何圖像。實際調整
成適當的分層尺寸,並且將它增加到分層樹的工作,還是由你來處理︰
CALayer* parentLayer ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

網頁互動式資料視覺化:使用D3

網頁互動式資料視覺化:使用D3

Scott Murray
深入淺出代數

深入淺出代數

Tracey Pilone, Dan Pilone
自然语言处理实战:从入门到项目实践

自然语言处理实战:从入门到项目实践

Sowmya Vajjala, Bodhisattwa Majumder, Anuj Gupta, Harshit Surana

Publisher Resources

ISBN: 9789862768136