Skip to content

Instantly share code, notes, and snippets.

View AmitaiB's full-sized avatar

Amitai Blickstein AmitaiB

View GitHub Profile
@AmitaiB
AmitaiB / JWPlayer+Mute.swift
Last active June 1, 2022 15:36
Extends JWPlayer to have basic mute API
//
// JWPlayer+Mute.swift
//
// Created by Amitai Blickstein on 6/1/22.
//
import Foundation
import JWPlayerKit
fileprivate let kVolumeKey = "kVolumeKey"
@AmitaiB
AmitaiB / JWAdCompanion_MockImplementation.swift
Last active July 6, 2022 15:55
Quick and dirty JWAdCompanion implementation
// In a JWPlayerViewController, with player configured, etc.
// For example, our BPA: https://github.com/jwplayer/jwplayer-ios-bestPracticeApps
// Override the implementation of this JWAdDelegate method,
// which reports when any ad event is emitted by the player.
override func jwplayer(_ player: AnyObject, adEvent event: JWAdEvent) {
super.jwplayer(player, adEvent: event) // When overriding (only), must call the `super` method.
if let companions = event[.companions] as? [JWAdCompanion] {
handleCompanion(companions.first)
}