Giter Site home page Giter Site logo

wistiakit's Introduction

NO LONGER MAINTAINED

This repository remains available for Wistia customers to use, but please be aware that it is not maintained and will not be receiving updates, bug fixes, or new features. We appreciate all of the feedback and contributions that our customers have given to WistiaKit.

WistiaKit

The best way to play Wistia video on iPhone, iPad, and Apple TV. Written in Swift.

Your Video on iOS in 5 minutes!

Disclaimer 1: You need to have Xcode 9 installed (which will take > 5 minutes if you don't already have it updated) Disclaimer 2: You need to have RubyGems installed (which may also take a little while)

Ok, got that out of the way. Now for the fun and fairly easy part!

  1. Install Cocoapods if you haven't already: gem install cocoapods
  2. pod try WistiaKit will pull this Pod down and open it in Xcode
  3. Choose the "WistiaKit-Example" project next to the play icon and press play!

This simple app lets you enter the Hashed ID of any media and play it. Look at the code in WistiaKit/Example for Wistia Kit/ViewController.swift and look at the basic interface in WistiaKit/Example for Wistia Kit/Main.storyboard. That's all there is to it; two interface outlets, one custom instance variable, and three lines of code to play the video.

Your Video on tvOS (Apple TV)

Just add the WistiaKit pod to any tvOS project. Yup, that's it.

Two caveats:

  1. There is not yet an example project (like above). So it may take more than 5 minutes.
  2. The WistiaPlayerViewController is not available on tvOS. Instead, create a WistiaPlayer and an AVPlayerViewController and marry them with avPlayerVC.player = wistiaPlayer.avPlayer. We think the AVPlayerViewController looks great on the TV and would be hard pressed to do better.

You Improve WistiaKit

We're still in the early phases of developing this thing. Please get in touch with us (Create an issue, a pull request, email or tweet at Wistia, etc.) to let us know what you'd like to see in WistiaKit.

Requirements

You need a Wistia account on the Platform plan. You'll also need some videos in your account. And at this point in the game, you need the Hashed ID of the video you'd like to play.

Installation

CocoaPods

WistiaKit is available through CocoaPods.

CocoaPods 1.1.0+ is required to build WistiaKit 0.12+.

To install, simply add the following line to your Podfile:

pod "WistiaKit"

Carthage

Starting from 0.30.2 WistiaKit should work with Carthage. Don't forget to include Alamofire and AlamofireImage as they are used by WistiaKit. Sample Cartfile:

github "Wistia/WistiaKit" ~> 0.30.2
github "Alamofire/Alamofire" ~> 4.4
github "Alamofire/AlamofireImage" ~> 3.1

This creates 2 frameworks WistiaKit and WistiaKitCore as explained inthe Usage section below.

Just remember to include the necessary frameworks in your swift code like this:

 import WistiaKit
 import WistiaKitCore

Usage

WistiaKit is conceptually divided into two tranches; playback and core. Depending on your application, you may use both components -- which work seamlessly together -- or either of them independently. Let's briefly get to know them before diving into the details.

Playback is akin to a web embed. You can present a WistiaPlayerViewController and play any of your videos using nothing but its hashedID. Customizations are applied to the player and statistics are tracked like normal; you need do nothing extra. Run the example project in this pod to see it in action (pod try WistiaKit then hit ▶ in Xcode >= 8.0).

If you don't want all the chrome (ie. player controls, scrubber, time, initial poster, etc.) you can get a little lower level with WistiaPlayer. You still need just a hashedID, but all you get is an AVPlayerLayer which you can present and gussy up however you wish. All your Wistia statistics are belong to us are tracked like normal. Psst: the WistiaPlayerViewController uses the WistiaPlayer under the hood.

Core is provided through the Data API. We've Swift'd it up, built a bunch of structs, and added some nice syntactic sugar. And the end result -- we hope -- is that it feels natural whether you're coming from another code-level interface to the Data API or the web view you use to manage your account. Initialize a WistiaAPI object with an API Token from your account and you're off to the races. View account details, list your projects, dig into your medias; everything you can do from the Data API, you can do from here.

Bring them both together: create a WistiaAPI to browse your WistiaProjects, choose a WistiaMedia, use that WistiaMedia object to initialize a WistiaPlayerViewController, and then self.presentViewController(_:animated:completion:)! It's so easy, I bet you could build a pretty nice Apple TV app in a hackathon...

Why did we pull the API interface and data models into WistiaKitCore? For the times when you don't need playback. Especially when some of the APIs used in WistiaKit are unavailable but you still wish to view or manipulate account data. Example: include only WistiaKitCore when implementing an App Extension (or a Framework that will be used in an App Extension).

Video upload is where it all begins! Technically part of the WistiaAPI but cool enough to get it's own section. Simply create a URL pointing to a movie on the device, or a Data of the movie itself, and upload into your account with just one line.

Core

I guess there's not much to say here. Mostly just refer to the Data API docs. And of course, you should use an instance of WistiaAPI to intrect with the API. For example:

import WistiaKitCore

let globalAPI = WistiaAPI(apiToken:"C4NTB3L13V3TH1S1SARAND0MT0K3N")

func printMediasByProject(){
    globalAPI.listProjects { (projects, error) in
        for project in projects {
            print("\(project) medias:")
            globalAPI.listMedias(limitedToProject: project, completionHandler: { (medias, error) in
                for media in medias {
                    print("  \(media)")
                }
            })
        }
    }
}

Caveat: WistiaKitCore is not yet Data API complete. But it will be. If there's some functionality that you want, but is not yet available, let us know by submitting a Pull Request ☺ or creating an issue.

A Note About Structs

New to iOS programming, via Swift, is the expanded availability of value semantics. We'll discuss exatly what that means in soon.

In the good old days of Objective-C you had objects. These were your classes and what not. When you passed objects into methods, or stored them in variables, you were always talking about the same object. This is because your object was a reference type. You were actually passing around references (aka pointers) to the object.

But even then you had value types. A good example were your integers. If you said a = 4 and b = a, you set both a and b to the value of 4. They weren't pointing to an object. So b++ didn't change the value of a, it would remain 4.

Enter Swift and a whole lot more value types! Now we have struct s (and enum s and tuples) that may remind us of reference types, but are actually value types. In WistiaKitCore, your data objects are struct s. So if you let a = someMedia and let b = a, your variables a and b have independent copies of that WistiaMedia. If you change something, like a.name = "whatever", this won't affect b.name.

We think this makes WistiaKitCore less error prone and makes it easier to reason about your code.

If you want to spend some guru meditation time on this, you could do worse than starting with the Swift Blog and a WWDC 2015 talk.

Upload

Whether you take a video with the camera, download it from the web, or pull it from iCloud, it's just one line to upload to Wistia. The hardest part should be locating the file URL or Data. And that's pretty easy ;-]

import WistiaKitCore

let api = WistiaAPI(apiToken: "C4NTB3L13V3TH1S1SARAND0MT0K3N")

let fileURL = Bundle.main.url(forResource: "hello", withExtension: "mov")

api.upload(fileURL: fileURL!, into: "ProjectHashedID", name: "Hello, World!", 
  progressHandler: { progress in
    print("reticulating splines... \(progress)")
  }, 
  completionHandler: { media, error in
    print("You've got media! \(media)")
  })

Shouldn't need it, but it's nice to know the Wistia Upload API documentation is also available.

Playback

The first thing to do is decide how you'd like your video player to look. If you're familiar with video playback on iOS already, then all you need to know is: WistiaPlayerViewController ~= AVPlayerViewController and WistiaPlayer ~= AVPlayer. If you're new to video on iOS, or just need a refresher, read on.

Those who like the look of our web player -- including (most) customizations -- and/or don't want to do a ton of UI buliding should use the WistiaPlayerViewController. You may present it fullscreen or within a ContainerView inside your own ViewController. It comes with standard playback controls and some nice delegate methods for you to hook into.

For those of you who want total control, you want the WistiaPlayer. To see the video you will need to present the AVPlayerLayer vended by your instance of the WistiaPlayer. And you'll need to programatically control the WistiaPlayer yourself; an AVPlayerLayer renders only video and includes no player controls or other UI. As you can see, with great power comes great responsibility. :-P

Initializing WistiaPlayerViewController or WistiaPlayer

  • referrer - We recommend using a universal link to the video. This will allow you to click that link from the Wistia stats page while still recording the in-app playback location. If you are using Domain Restrictions, the referrer should include the http(s) protocol and match a domain in your whitelist or video will not load.
  • requireHLS - Apple has specific requirements for playing video within apps. It boils down to this: if you want to play video over 10 minutes in length over the celluar network (ie. you don't force wifi), then you must use HLS. And Wistia fully supports and has thoroughly tested our HLS implementation with Apple. We recommend leaving this to true which is the default.

WistiaPlayerViewController Example

Lets say we're building an app that has an introductory section. We can use a single WistiaPlayerViewController to load any number of intro videos and present them full screen, as in the following example:

import WistiaKit

class IntroductionViewController: UIViewController {

  let wistiaPlayerVC = WistiaPlayerViewController(referrer: "https://wistia.tv/intro")

  func loadVideoWithHashedID(hashedID: String) {
    wistiaPlayerVC.replaceCurrentVideoWithVideoForHashedID(hashedID)
    self.presentViewController(wistiaPlayerVC, animated: true, completion: nil)
  }
}

This will load the video, but it is up to the user to play and otherwise interact with the content.

WistiaPlayer Example

If we want our intro video to behave a little differently, we might use a WistiaPlayer. In the following example, we play an intro video without giving the user any way to control the video. They have to sit there and watch it! <evil>bwaa ha ha ha!</evil> When video playback completes, we automatically progress to the next intro screen.

Below, we display the video with a WistiaFlatPlayerView, which is a plain UIView backed by an AVPlayerLayer. This layer is configured to display video content when you set the view's wistiaPlayer property to an instance of WistiaPlayer. While it behaves like any other UIView, allowing you to use common and familiar lifecycle and layout mechanisms, you may clamor for more power.

A standalone AVPlayerLayer is avaiable through an WistiaPlayers newPlayerLayer() method. Upon requesting this layer, any previously configured layers or view's will cease to render the content for that player. A newly initialized AVPlayerLayer - like any CALayer - should have its frame set before being added as a sublayer. You are also responsible for maintaining layout at the layer level, either manually, with CAConstraints, or an other layer-based mechanism.

import WistiaKitCore
import WistiaKit

class IntroductionViewController: UIViewController, WistiaPlayerDelegate {

  let wistiaPlayer = WistiaPlayer(referrer: "https://wistia.tv/intro")
  
  // In Interface Builder we set the view's class to WistiaFlatPlayerView.  
  // If we had a compelling reason, we could instead use an AVPlayerLayer directly via `newPlayerLayer()`.
  // But a UIView is more familiar without sacrificing much flexibility.
  @IBOutlet weak var playerContainer: WistiaFlatPlayerView!
  
  override public func viewDidLoad() {
    wistiaPlayer.delegate = self
    playerContainer.wistiaPlayer = wistiaPlayer
    wistiaPlayer.replaceCurrentVideoWithVideoForHashedID(IntroVideoHashedID)
  }
  
  //Mark: - WistiaPlayerDelegate
  
  public func wistiaPlayer(player:WistiaPlayer, didChangeStateTo newState:WistiaPlayer.State) {
    switch newState {
    case .VideoReadyForPlayback:
      wistiaPlayer.play()
    default:
      //ignoring, but probably shouldn't
    }
  }

  public func wistiaPlayerDidPlayToEndTime(player: WistiaPlayer) {
    self.showNextIntroScreen()
  }
  
  // ... rest of delegate methods ...
  
}

Closed Captioning

If you are using the WistiaPlayerViewController, closed captioning if fully supported right out of the box. You don't need to do anything more!

For those interpid slingers of the codez using WistiaPlayer directly, we've made it fairly simple to display captions. Grab the WistiaPlayer.captionsRenderer -- an instance of WistiaCaptionsRenderer configured for that player -- and hook up its captionsView to a view in your UI that overlays the video view. The renderer handles the under-the-hood work of retrieving the captions, timing data, updating the UI content, and mainting proper UI visibility. Captions are kept up to date during playback and seeking across all videos loaded by the WistiaPlayer. Control what captions, if any, are displayed with the enabled and captionsLanguageCode properties of the WistiaCaptionsRenderer.

Audio Playback

Enabling audio playback when the user has their device switched to vibrate mode must be done by you, in your application:

AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback)

WistiaKit does not presume to read minds ;-]

Player APIs

Up above are a bunch of words that explain how WistiaKit is structured, how to approach it, and some examples of how to use it. It's good to know the lay of the land. But as they say, the map is not the terrain. You're ready young padawan, go forth and read the appledoc.

Author

d j spinosa, [email protected]

License

WistiaKit and WistiaKitCore are available under the MIT license. See the LICENSE file for more info.

wistiakit's People

Contributors

acj avatar chiehwen avatar gbuilds avatar hardythedrummer avatar mergesort avatar mrdavidjcole avatar rlester avatar spinosa avatar thijsnado avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wistiakit's Issues

assets missing resolutions / PaintCode

Looking at the Pod/Assets/WistiaKitAssetCatalog.xcassets I see that:

  • @3 is missing skullNBones
  • @2 en @3 is missing for closedCaptions

I have been using PaintCode to avoid using images for over 2 years now to high effect, it would maybe be a good idea to do the same. If you have the icons in SVG you can import them in PaintCode generate a stylkit...

WistiaMediaStats JSON has changed

There are two stats formats. One from the Data API (https://wistia.com/doc/data-api#medias_stats) which hasn't changed. And another from the media info api (https://fast.wistia.net/embed/medias/\(hash).json) which returns new stats buried deep in the Media.

Should our stats object accept both formats?

There is no harm being caused right now since the media info route is only used internally and we don't really care that stats aren't properly parsed (since it's handled gracefully).

direct access to thumbnail url without API call

I have been using wistiaAPI.showMedia and the resulting media.thumbnail.url for retrieving the URL for downloading the thumbnail image. Problem is that this wistiaAPI.showMedia call takes to much time (somewhere between 2 - 12 seconds!) which makes the UI of the app to slow (thumbnails are displayed in a tableview for different videos).

I notice the returned urls all have the same format like:

https://embed-ssl.wistia.com/deliveries/ab986f28e43f03cd2d58805a89b6b4925062ffdc.jpg?image_crop_resized=200x120
https://embed-ssl.wistia.com/deliveries/013bf05eed6b89038dd2a12a13b82d5b559659fa.jpg?image_crop_resized=200x120
https://embed-ssl.wistia.com/deliveries/c2bd1513301ad3f619ab2a8142346c5232157d82.jpg?image_crop_resized=200x120
...

In order to avoid the web service call round-trip, would it be possible to construct the thumbnail url inside the app based on the wistia hash id somehow?

check the status before using the asset

Currently assets are being considered independent from their status.
This means that its possible that incomplete (status = 1 I believe?) or error-ed assets (status -1 I believe?) can be returned. These assets I believe can not be played (yet).
What are the enum types of the status codes?

Offline playback

In the project I am working on, I have similar needs as were described in #46, but wanted to open discussion about full offline playback.

My plan was to save files to disk that we get from Wistia (via the API if necessary), and play them back, but I don't see any way to do that via WistiaKit, and would have to rebuild it via AVPlayer.

If this is something you're willing to consider, there are two ways that I think would be reasonable techniques that would be reasonable, and of course other possibilities I haven't considered.

  1. Add a parameter that allows storing a video offline, and then allowing playback via an identifier, with offline.

This would look something like this:

let wistiaPlayerViewController = WistiaPlayerViewController()
wistiaPlayerViewController.replaceCurrentVideoWithVideo(forHashedID: "lalaland", cached: true)
  1. Allow playback to be transparently determined, read off the disk if it's available, similar to the solution that @hardythedrummer suggested, with some sort of way to provide knowledge whether the file is available offline.

This would look something like this:

let wistiaPlayerViewController = WistiaPlayerViewController()
if wistiaPlayerViewController.isAvailableOffline(forHashedID: "lalaland") {
    wistiaPlayerViewController.replaceCurrentVideoWithVideo(forHashedID: "lalaland")
}
  1. Allow playback from any offline file, by exposing WisitaKit internals, passing the video through to the AVPlayerViewController subsystem that WistiaKit hides.

This would look something like this:

let wistiaPlayerViewController = WistiaPlayerViewController(fileUrl: "file://myCoolFile.mp4")

Personally I favor solution 2, since it mimics Apple's file APIs, and is more explicit in telling us whether offline playback is supported. I'd love to hear what you think about this, and if this is something that can be built into WistiaKit.

Thanks a lot!

Thoughts on adding media caching?

I'm looking to write a TvOS app that will loop thru a playlist repeatedly as a form of digital signage in a storefront. Since it's just going to be playing the same videos repeatedly, it makes sense to not download the media every time, but I don't see any way to inject into the player object to cache the media assets manually, nor any options to have WistiaKit do so. Are there any plans to add support for media caching? If not, I'd be willing to work on it myself and submit a PR, but I'd appreciate any guidance on what the best way to accomplish this would be.

Enable audio with ringer switch turned off

Hi again! I'm back with another feature request. Our app is an online school, which means the expectation is for sound to be on when the user starts watching a video.

This below worked, though it might want to be masked.

do {
    try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback)
} catch(let error) {
    // Handle the error ¯\_(ツ)_/¯
}

I can imagine not everyone would want sound to default to on, so my naive solution would be to allow people to externally set the AVPlaybackCategory, or hide it behind a boolean such as canPlaySoundWhenSilentModeEnabled.

I'd love to hear what we can do to enable this functionality. Happy to contribute with more feedback as needed.

Thanks!

Fix share link

It's a vestige of Stargazer. Needs to be generic. Is there a share URL included in WistiaMedia metadata?

Expose WistiaPlayer from WistiaPlayerViewController

I wanted to expand upon an idea I broached in #33.

There are a few things I've wanted to do using a WistiaPlayerViewController which would work in AVPlayerViewController, which are not possible in WistiaKit currently.

One thing AVPlayerViewController allows you to do is change the playback rate via AVPlayerViewController's .player property, which is something I would like to be able to do as well. Another as mentioned before is to change it's seek time.

The more I'm using WistiaKit, the more of these situations I run across, like trying to get the currentTime, the more I think that the right solution rather than exposing some of these via a shim is to just expose the .player property on WistiaPlayerViewController.

I look forward to hearing your thoughts and feedback.

Thanks!

Cannot play video with SDK

Hi,
I have tried WistiaKit sample code.

  • WistiaPlayerViewController will show up skull sign (cannot play).

simulator screen shot 4 nov 2016 10 19 21 pm

  • WistiaPlayer cannot play in China network, can play with error
ParserError(message: "The key \'pageLoads\' was not found.")

The same video in website plays normally.
https://fast.wistia.net/embed/iframe/8tjg8ftj2p

What step I do wrong? Please feel free to ask me for detail, thanks.

captions not showing

I am using the below code to play a sample video I made that contains English and Dutch captions.

  1. Captions are not showing
    2.How can I set the language to use for the captions? My app contains a manual language selection that is different from the iOS language...

HashId of sample video is 1m9zwtusb3 you can play by:
https://hixfield.wistia.com/medias/1m9zwtusb3

    func playVideo(hashedID: String) {
        let vc = WistiaPlayerViewController(referrer: "", requireHLS: true)
        vc.replaceCurrentVideoWithVideoForHashedID(hashedID)
        presentViewController(vc, animated: true, completion: nil)
    }

Domain restrictions & HLS playback don't mix: 'requested media could not be found'

When embedding a video from an account with Domain Restrictions enabled, the video should be able to play if the referrer is set to a whitelisted domain, as described at https://github.com/wistia/wistiakit#initializing-wistiaplayerviewcontroller-or-wistiaplayer.

This does not currently work for HLS videos though (which is most videos), since (per @spinosa) WistiaKit does not add the referrer when requesting the m3u8 manifest file.

HLS implementation differs from Wistia support suggestion

Hi,
we're trying to integrate native playback of Wistia assets into our iOS app. We use parts of the WistiaKit (WistiaAsset, WistiaMedia and WistiaService) to parse the API responses and select the best asset. As Apple requires the use of HLS for our app, we asked the support to enable it for our account. Jay responded that appending .m3u8?segment_duration=3 to the URL + hash is the way to go and enabled HLS support for our account and all already uploaded media files.

The implementation within WistiaKit has special handling of m3u8 assets as well and tries to use those assets instead of basic mp4 files. Using this technique and passing the found asset.url, wrapped into an AVURLAsset which is wrapped into an AVPlayerItem, to an AVPlayer starts the playback just fine. The API returns assets with m3u8 containers and the corresponding URL has a .bin ending.

However forcing a url in the style suggested by the Wistia Support doesn't seem to work. Furthermore playback on 2G doesn't seem to reduce the video quality. If I run Apples mediastreamvalidator tool on a https://fast.wistia.net/embed/medias/<thehashedid>.m3u8?segment_duration=3 url the tool loops and doesn't return a correct report. A corresponding StackOverflow answer mentions appending m3u8 as well.

Could you explain the right way for integrating Wistias HLS capabilities into an iOS app and why your implementation differs from the Wistia support explanation? Apple seems to be quite strict about allowing media streaming on cellular networks and we don't want to risk a rejection because of it.

Thanks
Malte Baumann

WistiaPlayerViewController stuck in error mode

Using WistiaPlayerViewController in the Example app

  1. Play a video with a good hashedID: X
  2. Play a video with a bad hashedID
  3. See the error screen, as expected
  4. Close VC
  5. Change hashedID back to the valid one: X
  6. Observe error screen. Unexpected. Should load and present video like normal.

Layout crash

We're gotten about a dozen of these crash reports coming from WistiaPlayerViewController in our app, across just a few hundred users.

The crash is occurring in this call, across devices, OS's, screen sizes, etc.

WistiaPlayerViewController.present(forProgress : Float, currentTime : CMTime?) -> ()

Specifically:

NSInternalInconsistencyException
Application threw exception NSInternalInconsistencyException: NSLayoutConstraint constant is not finite!  That's illegal.  constant:nan firstAnchor:<NSLayoutDimension:0x172c68380 "UIView:0x14598cec0.width"> secondAnchor:(null)

Let me know if there's any more information I can provide you with. Thanks!

IDFA Usage

Why is IDFA used and not stated anywhere that it is used and why?...
I had the surprise at the app submission to see that the app is using the IDFA after integrating the sdk. None of the provided options seem to be appropriate to select at submission...how should we go around this?

NSURLSession instead of AlamoFire

Hi there,

I'm integrating WistiaKit into a project I'm working on, and I was wondering if it would be possible to use NSURLSession rather than AlamoFire. It seems like AlamoFire is being rather sparingly within the actual project, and since WistiaKit is an SDK, it seems unfortunate to ask for app authors integrate this dependency.

I'd be happy to contribute some time in transitioning it, if there is indeed interest.

Thanks a lot!

Removing dependency to Alamofire

Alamofire is a huge networking library and a very big dependency to pull into this relatively small SDK. It is currently used to send two simple GET and one POST request.

This can be done with URLSession without having to pull in a big dependency, making the overall footprint of the SDK much smaller.

Airplay Support

Since the WistiaPlayer is backed by AVPlayer, it should support Airplay by default. However, the WistiaPlayer hides the underlying AVPlayer and thus the AirPlay API.

Am I looking at this correctly? Or is there another way to get access to AirPlay and get Wistia videos on Airplay devices?

UIEffect views need tweaking

blur + vibrancy on some backgrounds makes interface elements difficult or impossible to read

Check on a video with white background and default controls color styling

/cc @jayholman

Crashing when still loading then rotating the wistiaviewcontroller

Hi man,

The app crash here:
internal func present(forProgress progress: Float, currentTime: CMTime?){
guard progress.isFinite else {
assertionFailure("progress expected to be finite")
return
}

When I try to rotate the device while it is still loading.
Great job by the way

-marlon

Send Referer on mediaInfo API request

The mediaInfo route checks Referer to implement Domain Restrictions. If the Referer isn't sent, an error is returned.

Cannot implement with a default configuration of SessionManager including referrer since each WistiaPlayer(ViewController) can be created with a different referrer.

Make sure to add an IMPORTANT callout in the initializers for WistiaPlayer and WistiaPlayerViewController that mentions Domain Restrictions with a link to https://wistia.com/doc/account-setup#domain_restrictions

/cc @jayholman

Polish Jazzy documentation generation

  • WistiaPlayerViewController is doubled
  • WistiaPlayerViewController is considered undocumented even though it is documented
  • WistiaPlayerViewControllerDelegate is doubled
  • WistiaPlayerViewControllerDelegate is considered undocumented even though it is documented
  • LatitudeLongitude typealias probably shouldn't show up. Or should be clean/documented if it must

See http://cocoadocs.org/docsets/WistiaKit

playing video autorotation?

My app only support portrait mode except...
Previously when I was using the standard AVPlayerViewController the video played full screen
and in landscape (if device was rotated), which is what I need.

Now when using WistiaPlayerViewController the player is locked in portrait mode.

I use this code to play:

func playVideo(hashedID: String) {
    let wistiaPlayerVC = WistiaPlayerViewController(referrer: "", requireHLS: true)
    wistiaPlayerVC.replaceCurrentVideoWithVideoForHashedID(hashedID)
    self.presentViewController(wistiaPlayerVC, animated: true, completion: nil)
}

Video not showing in WistiaPlayer

I am trying to integrate WistiaPlayer with our App for the onBoarding videos. The problem which we are facing is, the video in UIView doesn't show-up but the audio is there. I am only able to hear audio. Below is the snippet from the code-base, can anyone guide me what possibly is going wrong;

    override func viewDidLoad() {
        super.viewDidLoad()

        self.view.setNeedsLayout()
        self.view.layoutIfNeeded()

        wistiaPlayer.delegate = self
        wistiaPlayer.replaceCurrentVideoWithVideoForHashedID("id")

        videoPlayer.layer.addSublayer(wistiaPlayer.newPlayerLayer()!)
        videoPlayer.clipsToBounds = true
        videoPlayer.layer.masksToBounds = true
    }

Disregard `"public": false` assets when selecting for playback

Wistia videos have a bunch of assets. One of those assets is a low FPS mp4 file, like https://embed-ssl.wistia.com/deliveries/3ba323d378f11abaa8a75244bbad0a92fbae3824.bin, for the media with hashed id mo7xzk0d6m.

That asset should never get played. It exists only for the engagement graph overlay interface on Wistia media stats pages.

That asset is not returned in the response from the API's medias#show response, and yet somehow WistiaKit knows about it, and chooses it as the asset to play.

This only happens when check for the presence of HLS assets fails (see #44), so fixing that should make this much less likely to occur. But it still should never occur.

Swift 3.1 warnings

Would it be annoying to ask for a pod update to address #48? Warnings and what not. 😅

Expose seek time to WistiaPlayerViewController

I'm working on a project where I play a video in-line, and when the user taps on it, it automatically expands into a full-size view. To accomplish this, I'm going from a WistiaFlatPlayerView, taking it's hashed ID, and creating a WistiaPlayerViewController that I present.

If the user is in the middle of watching the video, I would like to start the video at the point where they left off in-line. I noticed your internal implementation would be able to do that, but it's not exposed to the public facing API because WistiaPlayerViewController's WistiaFlatPlayerView is internal to the framework.

Would it be possible to expose the seek function externally, or allow access to WistiaPlayerViewController's WistiaFlatPlayerView for public consumption?

Thanks a lot!

change data model structs to classes?

I suspect that lots of folks aren't used to structs and value semantics. Especially coming from Obj-C / iOS land.

Leaving this issue as a reminder to self; need to think this through a bit more.

Seeing skull instead of videos

Hi there,

I wanted to re-open #32, because we are seeing it as well. There doesn't seem to be a reproducible pattern, except that the WistiaMediaStats object failed to parse (because of missing data), and as a result the video will not play.

I didn't get a chance to dig into the current implementation too much, but it feels like those two should be decoupled if possible.

Medias are not playing

Hi. I need to get media by hash id, change start paying position and play video.

I use follow code to show player VC from media model but getting "white page & skull screen":

globalAPI.showMedia(forHash: "xxx") { media, error in
      self.wistiaPlayerVC.replaceCurrentVideoWithVideo(forMedia: media!, autoplay: true)
      self.present(self.wistiaPlayerVC, animated: true, completion: nil)
}

When I tested this hash with another method

wistiaPlayerVC.replaceCurrentVideoWithVideo(forHashedID: "xxx")

I noticed that received media models are different.

How I can do follow:

  1. Get media by hash id
  2. Set start paying position
  3. Play video

Fix algo and options for captions

Captions are off unless plugin.captions-v1 exists. If it does...
plugin.captions-v1.on - turn on/off the CC button
plugin.captions-v1.onByDefault - the CC button is in the on state when player loads (iff captions are also on, showing the button in the first place)

/cc @MaxPower15

Usage of dynamic hls m3u8 file

I have recently been in contact with wistia support. They have learned met that its now possible to fetch a "dynamic" m3u8 file from wistia that includes all the hls streams. As so called adaptive m3u8. If this one is given to the AVPlayer then following apple docs, the avplayer selects the right bandwidth depending on some algorithme (that I guess olny apple knows). I would suggest using this dynamic m3u8 in wistiakit and let Apple choose the stream instead of doing it ourselves. Given apple guideline 9.4 for app approval this should give us compliancy...? Certainly if an audio onky stream of less then 192kps is included.

Carthage support?

We are using Carthage as dependency manager on a big project. Your library doesn't seem to support it as it has no shared framework scheme. Here is the error returned by Carthage:

capture d ecran 2017-02-15 a 09 03 12

Is there any plan on your side to support Carthage?

video played immediately via segue in prepareForSegue leaves play button

I have my own VC with a segue to a WistiaPlayerViewController, I use performSegue to start playing (gives me some advantages when moving to iPad).

screen shot 2016-09-05 at 09 05 17

However I want the video to play straight away
it does play immediately using the below code. However the big playbuton > stays on the screen.

simulator screen shot 05 sep 2016 09 02 16

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        if let
            vc = segue.destinationViewControllerPossiblyAfterNavigationController as? WistiaPlayerViewController,
            video = sender as? Video {
            vc.replaceCurrentVideoWithVideoForHashedID(video.wistiaHashId)
            vc.play()
        }
    }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.