logo
SDKs
IntroductionHow to update an SDK?THEOplayer 5.0 - Native Mobile iOS/tvOS and Android SDKs
Web
Getting started on Web (Extended)Getting started with the new Web UIGetting started on WebAPI examplesHow to implement Keyboard HotkeysHow to embed an iframeHow to implement a seamless transition between videos?How can I use video inside THEOplayer?How to work around browser cache with a new license?How to customise quality selection & labels (MP4)How to get frame-accurate currentTime display in the UI Control barHow to play an LCEVC source with THEOplayerHow to use WebXR with THEOplayer
Android legacy (4.12.x)
Getting started on Legacy Android SDK (4.12.x)Legacy Android SDK (4.12.x) customizationHow to couple the native MediaRouteButton to THEOplayerHow to enable -experimental- native rendering on AndroidHow to do offline Playback with AES-128 Encrypted Streams on Android
Android
Getting started with the Android UIGetting started on AndroidAndroid Feature IntegrationsMigration from THEOplayer Android/AndroidTV/FireTV SDK 4.x to THEOplayer Android SDK 5.0
iOS legacy (4.12.x)
Getting started on iOSiOS/tvOS SDK and Legacy iOS/tvOS SDK (4.12.x) CustomizationMy app does not want to build for the app storeHow to bypass copy() not working in Safari consoleHow to couple the native GCKUICastButton to THEOplayeriOS/tvOS SDK and Legacy iOS/tvOS SDK (4.12.x) Touch-events (gestures)Building for iOS Simulator, but the linked and embedded framework THEOplayerSDK.framework was built for iOS + iOS SimulatorHow to implement custom local network access (LNA) interstitial dialog for Chromecast
iOS
Getting started guide for THEOplayer iOS/tvOS SDK 5.0THEOplayer iOS/tvOS 5.0 Feature IntegrationsMigration from THEOplayer iOS and tvOS SDK 4.x to THEOplayer iOS/tvOS SDK 5.0
Android TV Legacy (4.12.x)
Getting started on Android TV Legacy (4.12.x)
tvOS
Getting started on tvOS
Chromecast
Getting started on ChromecastChromecast Application Customization
Webos
Getting Started on webOS
Tizen
Getting started on TizenInstalling the Tizen developer toolsSetting up a Tizen device for debuggingDeploying a test app on a physical Tizen deviceDeploying a test app on a Tizen emulator
Roku
Getting Started on Roku
Fire TV Legacy (4.12.x)
Getting started on Fire TV Legacy (4.12.x)
Frameworks

iOS/tvOS SDK and Legacy iOS/tvOS SDK (4.12.x) Touch-events (gestures)

Introduction

This page describes how to implement Touch-events (gestures recognizers) for THEOplayer in your iOS app. This is useful if you want to add specific behaviors for some or all gestures and need therefore to recognize them.

Note: To this end, the UIGestureRecognizerDelegate protocol needs to be implemented into the THEOplayerInternal_iOS class.

General Notions about gestures recognizers

This section contains some general notions about gesture-recognizers. For more complete information in this regard, please consult the Apple documentation pages (see link in Resources), from which most of the content of this section is a (though rearranged) quotation:

  1. A gesture recognizer decouples the logic for recognizing a sequence of touches (or other input) and acting on that recognition.
  2. A gesture recognizer has one or more target-action pairs associated with it. If there are multiple target-action pairs, they are discrete, and not cumulative. Recognition of a gesture results in the dispatch of an action message to a target for each of the associated pairs.
  3. The interpreted gesture can be either discrete or continuous. A discrete gesture (e.g.: double tap) results in a single action sent. A continuous gesture (e.g.: rotation gesture), an action message is sent for each incremental change until the multi-touch sequence concludes.
  4. A gesture recognizer operates on touches hit-tested to a specific view (and all its subviews). Therefore, it must be associated with that view.
  5. The THEOplayer css is not loaded when chromeless is enabled.

Supported use cases

Description Supported SDK's Description
UITapGestureRecognizer iOS 3.2+ Single or multiple taps. For this gesture to be recognized, the specified number of fingers must tap the view a specified number of times.
UIPinchGestureRecognizer iOS 3.2+ Pinching gestures involving two touches. When the user moves the two fingers toward each other, the conventional meaning is zoom-out; when the user moves the two fingers away from each other, the conventional meaning is zoom-in.
UIRotationGestureRecognizer iOS 3.2+ Rotation gestures involving two touches. When the user moves the fingers opposite each other in a circular motion, the underlying view should rotate in a corresponding direction and speed.
UISwipeGestureRecognizer iOS 3.2+ Swiping gestures in one or more directions. A swipe is a discrete gesture, and thus the associated action message is sent only once per gesture.
UIPanGestureRecognizer iOS 3.2+ Panning (dragging) gestures. The user must be pressing one or more fingers on a view while they pan it. Clients implementing the action method for this gesture recognizer can ask it for the current translation and velocity of the gesture.
UIScreenEdgePanGestureRecognizer iOS 3.2+ A gesture recognizer that looks for panning (dragging) gestures that start near an edge of the screen. The system uses screen edge gestures in some cases to initiate view controller transitions. You can use this class to replicate the same gesture behavior for your own actions.
UILongPressGestureRecognizer iOS 3.2+ Long-press gestures. The user must press one or more fingers on a view and hold them there for a minimum period of time before the action triggers. While down, the user’s fingers may not move more than a specified distance; if they move beyond the specified distance, the gesture fails.

How to use in THEOplayer iOS SDK

// create the Gesture Recognizer
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.tapGestureFired(sender:))) 
tapGesture.numberOfTapsRequired = 1

// attach the gesture to THEOplayer
self.theoplayer.addGestureRecognizer(tapG)

// get an array of all the attached Gesture Recognizers on THEOplayer
self.theoplayer.gestureRecognizers

// remove the gesture from THEOplayer
self.theoplayer.removeGestureRecognizer(tapG)

Resources

The following resources provide more information:

github
Make sure to follow us on GitHub!
THEO-logo-white
twitter
facebook
linkedin
Copyright © 2022. All Rights Reserved.
Leuven
New York
Singapore
Barcelona