Git Product home page Git Product logo

flowplayer-ios-sdk-light's Introduction

flowplayer

Flowplayer platform ios 10.0


This product is no longer supported. Please contact to [email protected] for an alternative product.


About

iOS SDK to easily allow you to play Flowplayer videos in your app.

Usage

Swift

import UIKit
import Flowplayer

class ViewController: UIViewController {
    @IBOutlet weak var playerView: FLPlayerView!
    @IBOutlet weak var progressLabel: UILabel!
    @IBOutlet weak var controllButton: UIButton!

    override func viewDidLoad() {
        super.viewDidLoad()
        playerView.load(withVideoId: "some_video_id", andPlayerId: "some_player_id")
        playerView.delegate = self
    }

    @IBAction func buttonPressed(_ sender: UIButton) {
        if playerView.isPlaying {
            playerView.pause()
            sender.setTitle("Play", for: .normal)
        } else {
            playerView.play()
            sender.setTitle("Pause", for: .normal)
        }
    }
}

extension ViewController: FLPlayerViewDelegate {
    // CurrentTime is in seconds
    func timeUpdate(_ currentTime: Float) {
        progressLabel.text = "Time elapsed: \(currentTime)"
    }
    func stateChanged(_ isPLaying: Bool) {
        controllButton.setTitle(isPLaying ? "Pause" : "Play", for: .normal)
    }
}

Objective-C

#import "ViewController.h"
#import <Flowplayer/Flowplayer.h>

@interface ViewController () <FLPlayerViewDelegate>
@property (weak, nonatomic) IBOutlet FLPlayerView *playerView;
@property (weak, nonatomic) IBOutlet UILabel *progressLabel;
@property (weak, nonatomic) IBOutlet UIButton *controllButton;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.playerView loadWithVideoId:@"some_video_id" andPlayerId:@"some_player_id"];
    [self.playerView setDelegate:self];
}

- (IBAction)buttonPressed:(UIButton *)sender {
    if (self.playerView.isPlaying) {
        [self.playerView play];
        [sender setTitle:@"Pause" forState:UIControlStateNormal];
    } else {
        [self.playerView pause];
        [sender setTitle:@"Play" forState:UIControlStateNormal];
    }
}

- (void)timeUpdate:(float)currentTime {
    self.progressLabel.text = [NSString stringWithFormat:@"%f", currentTime];
}

- (void)stateChanged:(Boolean)isPlaying {
    [self.controllButton setTitle: isPlaying ? @"Pause" : @"Play" forState:UIControlStateNormal];
}

@end

Requirments

  • Xcode 9.0
  • iOS 10.0

Not 100% tested.

Installation

Manual

Open either swift or objc example.xcodeproj, and hit run. This method will build everything and run the sample app

CocoaPods

# Podfile
use_frameworks!

target 'YOUR_TARGET_NAME' do
    pod 'Flowplayer', :git => '[email protected]:flowplayer/flowplayer-ios-sdk.git'
end

Replace YOUR_TARGET_NAME with the name of your target. In the Podfile directory, type:

$ pod install

After importing your framework:

  1. Drag a UIView onto your Storyboard.
  2. Change the UIView's class in the Identity Inspector tab to FLPlayerView
  3. Import Flowplayer in your ViewController.
  4. Connect outlets and actions
  5. Run your code!

flowplayer-ios-sdk-light's People

Contributors

emanuelflowplayer avatar gsavvid avatar mathipalm avatar sibe7691 avatar

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.