View in English

  • Apple Developer
    • Get Started

    Explore Get Started

    • Overview
    • Learn
    • Apple Developer Program

    Stay Updated

    • Latest News
    • Hello Developer
    • Platforms

    Explore Platforms

    • Apple Platforms
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store

    Featured

    • Design
    • Distribution
    • Games
    • Accessories
    • Web
    • Home
    • CarPlay
    • Technologies

    Explore Technologies

    • Overview
    • Xcode
    • Swift
    • SwiftUI

    Featured

    • Accessibility
    • App Intents
    • Apple Intelligence
    • Games
    • Machine Learning & AI
    • Security
    • Xcode Cloud
    • Community

    Explore Community

    • Overview
    • Meet with Apple events
    • Community-driven events
    • Developer Forums
    • Open Source

    Featured

    • WWDC
    • Swift Student Challenge
    • Developer Stories
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Centers
    • Documentation

    Explore Documentation

    • Documentation Library
    • Technology Overviews
    • Sample Code
    • Human Interface Guidelines
    • Videos

    Release Notes

    • Featured Updates
    • iOS
    • iPadOS
    • macOS
    • watchOS
    • visionOS
    • tvOS
    • Xcode
    • Downloads

    Explore Downloads

    • All Downloads
    • Operating Systems
    • Applications
    • Design Resources

    Featured

    • Xcode
    • TestFlight
    • Fonts
    • SF Symbols
    • Icon Composer
    • Support

    Explore Support

    • Overview
    • Help Guides
    • Developer Forums
    • Feedback Assistant
    • Contact Us

    Featured

    • Account Help
    • App Review Guidelines
    • App Store Connect Help
    • Upcoming Requirements
    • Agreements and Guidelines
    • System Status
  • Quick Links

    • Events
    • News
    • Forums
    • Sample Code
    • Videos
 

Vídeos

Abrir menu Fechar menu
  • Coleções
  • Todos os vídeos
  • Sobre

Mais vídeos

  • Sobre
  • Código
  • Discover rolling clips with ReplayKit

    Never again miss anyone's great moment in your game or app. Learn about ReplayKit's latest update — clips screen recording — which provides your app with a rolling buffer of past video and audio samples. When memorable moments happen, discover how you can record and save it for people, and find out how you can surface those clips when they're most relevant. Lastly, we'll take you through integrating ReplayKit into your iOS and macOS apps.

    Recursos

    • Recording and Streaming Your macOS App
    • ReplayKit
      • Vídeo HD
      • Vídeo SD

    Vídeos relacionados

    WWDC21

    • Tap into virtual and physical game controllers
    • Wednesday@WWDC21

    WWDC20

    • Capture and stream apps on the Mac with ReplayKit
  • Buscar neste vídeo...
    • 5:19 - Start clip buffering

      // Start clip buffering API call
      
      func startClipBuffering() {
          RPScreenRecorder.shared().startClipBuffering { error in
              if error != nil {
                  print("Error attempting to start Clip Buffering")
                  // Update the app recording state and UI.
                  self.setClipState(active: false)
              } else {
                  // No error encountered attempting to start a clip session.
                  // Update the app recording state and UI.
                  self.setClipState(active: true)
                  
                  // Set up camera View.
                  self.setupCameraView()
              }
          }
      }
    • 5:46 - Stop clip buffering

      // Stop clip buffering
      
      func stopClipBuffering() {
          RPScreenRecorder.shared().stopClipBuffering { error in
              if error != nil {
                  print("Error attempting to stop clip buffering")
              }
              // Update the app recording state and UI.
              self.setClipState(active: false)
              
              // Tear down camera view.
              self.tearDownCameraView()
          }
      }
    • 6:13 - Export clip button

      // Export clip button
      
      @IBAction func exportClipButtonTapped(_ sender: Any) {
          // If clip buffering is active, export clip
          if self.isActive && self.getClipButton.isEnabled {
              exportClip()
          }
      }
    • 6:41 - Export clip

      // Export clip
      
      func exportClip() {
          let clipURL = getAppTempDirectory()
          let interval = TimeInterval(5)
      
          print("Generating clip at URL: \(clipURL)")
          RPScreenRecorder.shared().exportClip(to: clipURL, duration: interval) { error in
              if error != nil {
                  print("Error attempting to export clip")
              } else {
                  // No error, so save clip at URL to photos
                  self.saveToPhotos(tempURL: clipURL)
              }
          }
      }

Developer Footer

  • Vídeos
  • WWDC21
  • Discover rolling clips with ReplayKit
  • Open Menu Close Menu
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store
    Open Menu Close Menu
    • Swift
    • SwiftUI
    • Swift Playground
    • TestFlight
    • Xcode
    • Xcode Cloud
    • Icon Composer
    • SF Symbols
    Open Menu Close Menu
    • Accessibility
    • Accessories
    • Apple Intelligence
    • Audio & Video
    • Augmented Reality
    • Business
    • Design
    • Distribution
    • Education
    • Games
    • Health & Fitness
    • In-App Purchase
    • Localization
    • Maps & Location
    • Machine Learning & AI
    • Security
    • Safari & Web
    Open Menu Close Menu
    • Documentation
    • Downloads
    • Sample Code
    • Videos
    Open Menu Close Menu
    • Help Guides & Articles
    • Contact Us
    • Forums
    • Feedback & Bug Reporting
    • System Status
    Open Menu Close Menu
    • Apple Developer
    • App Store Connect
    • Certificates, IDs, & Profiles
    • Feedback Assistant
    Open Menu Close Menu
    • Apple Developer Program
    • Apple Developer Enterprise Program
    • App Store Small Business Program
    • MFi Program
    • Mini Apps Partner Program
    • News Partner Program
    • Video Partner Program
    • Security Bounty Program
    • Security Research Device Program
    Open Menu Close Menu
    • Meet with Apple
    • Apple Developer Centers
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Academies
    • WWDC
    Read the latest news.
    Get the Apple Developer app.
    Copyright © 2026 Apple Inc. All rights reserved.
    Terms of Use Privacy Policy Agreements and Guidelines