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
 

Videos

Abrir menú Cerrar menú
  • Colecciones
  • Todos los videos
  • Información

Más videos

  • Información
  • Código
  • Enhance voice communication with Push to Talk

    We're coming in loud and clear to help you bring walkie-talkie communication to your app — over! Discover how you can add prominent system UI to your Push to Talk app, enabling rapid communication with the tap of a button. We'll introduce you to the PushToTalk framework and show you how to configure your apps to transmit and receive audio — even from the background.

    To get the most out of this session, we recommend familiarity with handling audio transmission on your app backend. We also recommend a basic understanding of APNs.

    Recursos

    • Push to Talk
      • Video HD
      • Video SD

    Videos relacionados

    Tech Talks

    • What's new for enterprise developers

    WWDC22

    • Power down: Improve battery consumption
    • Reduce networking delays for a more responsive app
    • WWDC22 Day 2 recap
  • Buscar este video…
    • 6:52 - Creating a Channel Manager

      func setupChannelManager() async throws {
          channelManager = try await PTChannelManager.channelManager(delegate: self,
                                                                     restorationDelegate: self)
      }
    • 7:33 - Joining a Channel

      func joinChannel(channelUUID: UUID) {
          let channelImage = UIImage(named: "ChannelIcon")
          channelDescriptor = PTChannelDescriptor(name: "Awesome Crew", image: channelImage)
        
          // Ensure that your channel descriptor and UUID are persisted to disk for later use.
          channelManager.requestJoinChannel(channelUUID: channelUUID, 
                                            descriptor: channelDescriptor)
      }
    • 8:11 - PTChannelManagerDelegate didJoinChannel

      func channelManager(_ channelManager: PTChannelManager, 
                          didJoinChannel channelUUID: UUID,
                          reason: PTChannelJoinReason) {
          // Process joining the channel
          print("Joined channel with UUID: \(channelUUID)")
      }
      
      func channelManager(_ channelManager: PTChannelManager,
                          receivedEphemeralPushToken pushToken: Data) {
          // Send the variable length push token to the server
          print("Received push token")
      }
    • 8:45 - PTChannelManagerDelegate failedToJoinChannel

      func channelManager(_ channelManager: PTChannelManager, 
                          failedToJoinChannel channelUUID: UUID, 
                          error: Error) {
          let error = error as NSError
      
          switch error.code {
          case PTChannelError.channelLimitReached.rawValue:
              print("The user has already joined a channel")
          default:
              break
          }
      }
    • 9:00 - PTChannelManagerDelegate didLeaveChannel

      func channelManager(_ channelManager: PTChannelManager,
                          didLeaveChannel channelUUID: UUID,
                          reason: PTChannelLeaveReason) {
          // Process leaving the channel
          print("Left channel with UUID: \(channelUUID)")
      }
    • 9:22 - PTChannelRestorationDelegate

      func channelDescriptor(restoredChannelUUID channelUUID: UUID) -> PTChannelDescriptor {
          return getCachedChannelDescriptor(channelUUID)
      }
    • 10:12 - Provide channel descriptor updates

      func updateChannel(_ channelDescriptor: PTChannelDescriptor) async throws {
          try await channelManager.setChannelDescriptor(channelDescriptor, 
                                                        channelUUID: channelUUID)
      }
    • 10:20 - Provide service status updates

      func reportServiceIsReconnecting() async throws {
          try await channelManager.setServiceStatus(.connecting, channelUUID: channelUUID)
      }
      
      func reportServiceIsConnected() async throws {
          try await channelManager.setServiceStatus(.ready, channelUUID: channelUUID)
      }
    • 11:48 - Start transmission from within your app

      func startTransmitting() {
          channelManager.requestBeginTransmitting(channelUUID: channelUUID)
      }
      
      // PTChannelManagerDelegate
      
      func channelManager(_ channelManager: PTChannelManager, 
                          failedToBeginTransmittingInChannel channelUUID: UUID,
                          error: Error) {
          let error = error as NSError
      
          switch error.code {
          case PTChannelError.callIsActive.rawValue:
              print("The system has another ongoing call that is preventing transmission.")
          default:
              break
          }
      }
    • 12:22 - Stop transmission from within your app

      func stopTransmitting() {
          channelManager.stopTransmitting(channelUUID: channelUUID)
      }
      
      func channelManager(_ channelManager: PTChannelManager, 
                          failedToStopTransmittingInChannel channelUUID: UUID, 
                          error: Error) {
          let error = error as NSError
      
          switch error.code {
          case PTChannelError.transmissionNotFound.rawValue:
              print("The user was not in a transmitting state")
          default:
              break
          }
      }
    • 12:41 - Responding to begin transmission delegate events

      func channelManager(_ channelManager: PTChannelManager,
                          channelUUID: UUID, 
                          didBeginTransmittingFrom source: PTChannelTransmitRequestSource) {
          print("Did begin transmission from: \(source)")
      }
      
      func channelManager(_ channelManager: PTChannelManager,
                          didActivate audioSession: AVAudioSession) {
          print("Did activate audio session")
          // Configure your audio session and begin recording
      }
    • 13:19 - Responding to end transmission delegate events

      func channelManager(_ channelManager: PTChannelManager,
                          channelUUID: UUID, 
                          didEndTransmittingFrom source: PTChannelTransmitRequestSource) {
          print("Did end transmission from: \(source)")
      }
      
      func channelManager(_ channelManager: PTChannelManager,
                          didDeactivate audioSession: AVAudioSession) {
          print("Did deactivate audio session")
          // Stop recording and clean up resources
      }
    • 15:29 - Receiving Push to Talk Pushes

      func incomingPushResult(channelManager: PTChannelManager, 
                              channelUUID: UUID, 
                              pushPayload: [String : Any]) -> PTPushResult {
      
          guard let activeSpeaker = pushPayload["activeSpeaker"] as? String else {
              // If no active speaker is set, the only other valid operation 
              // is to leave the channel
              return .leaveChannel
          }
      
          let activeSpeakerImage = getActiveSpeakerImage(activeSpeaker)    
          let participant = PTParticipant(name: activeSpeaker, image: activeSpeakerImage)
          return .activeRemoteParticipant(participant)
      }
    • 17:03 - Stop receiving audio

      func stopReceivingAudio() {
          channelManager.setActiveRemoteParticipant(nil, channelUUID: channelUUID)
      }

Developer Footer

  • Videos
  • WWDC22
  • Enhance voice communication with Push to Talk
  • 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