Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions Example/GPVideoPlayer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -210,24 +210,24 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0830;
LastUpgradeCheck = 0830;
LastUpgradeCheck = 1110;
ORGANIZATIONNAME = CocoaPods;
TargetAttributes = {
607FACCF1AFB9204008FA782 = {
CreatedOnToolsVersion = 6.3.1;
LastSwiftMigration = 0900;
LastSwiftMigration = 1110;
};
607FACE41AFB9204008FA782 = {
CreatedOnToolsVersion = 6.3.1;
LastSwiftMigration = 0900;
LastSwiftMigration = 1110;
ProvisioningStyle = Automatic;
TestTargetID = 607FACCF1AFB9204008FA782;
};
};
};
buildConfigurationList = 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "GPVideoPlayer" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Expand Down Expand Up @@ -386,6 +386,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand All @@ -394,12 +395,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -439,6 +442,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand All @@ -447,12 +451,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -493,7 +499,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -509,7 +515,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -534,7 +540,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GPVideoPlayer_Example.app/GPVideoPlayer_Example";
};
name = Debug;
Expand All @@ -556,7 +562,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GPVideoPlayer_Example.app/GPVideoPlayer_Example";
};
name = Release;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "1110"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -40,8 +40,17 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
codeCoverageEnabled = "YES"
shouldUseLaunchSchemeArgsEnv = "YES">
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "607FACCF1AFB9204008FA782"
BuildableName = "GPVideoPlayer_Example.app"
BlueprintName = "GPVideoPlayer_Example"
ReferencedContainer = "container:GPVideoPlayer.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -54,17 +63,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "607FACCF1AFB9204008FA782"
BuildableName = "GPVideoPlayer_Example.app"
BlueprintName = "GPVideoPlayer_Example"
ReferencedContainer = "container:GPVideoPlayer.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -86,8 +84,6 @@
ReferencedContainer = "container:GPVideoPlayer.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
31 changes: 23 additions & 8 deletions Example/GPVideoPlayer/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="vXZ-lx-hvc">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15400" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="vXZ-lx-hvc">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15404"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand All @@ -22,16 +20,29 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="vTe-w6-DGJ">
<rect key="frame" x="0.0" y="20" width="375" height="300"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="300"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
<constraint firstAttribute="height" constant="300" id="Dn6-ta-UfS"/>
</constraints>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="WEr-hD-XpC">
<rect key="frame" x="162.5" y="322" width="50" height="50"/>
<constraints>
<constraint firstAttribute="width" secondItem="WEr-hD-XpC" secondAttribute="height" multiplier="1:1" id="Sio-8T-d0t"/>
<constraint firstAttribute="height" constant="50" id="che-Zm-9pE"/>
</constraints>
<state key="normal" image="playpause.fill" catalog="system"/>
<connections>
<action selector="mediaPlayButtonPressed:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="cpw-4P-0Ww"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="backgroundColor" systemColor="secondarySystemBackgroundColor" red="0.94901960780000005" green="0.94901960780000005" blue="0.96862745100000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="vTe-w6-DGJ" secondAttribute="trailing" id="MLT-Pc-P6K"/>
<constraint firstItem="WEr-hD-XpC" firstAttribute="top" secondItem="vTe-w6-DGJ" secondAttribute="bottom" constant="22" id="epg-0V-ZIt"/>
<constraint firstItem="WEr-hD-XpC" firstAttribute="centerX" secondItem="kh9-bI-dsS" secondAttribute="centerX" id="fSW-62-tYX"/>
<constraint firstItem="vTe-w6-DGJ" firstAttribute="top" secondItem="jyV-Pf-zRb" secondAttribute="bottom" id="of8-l1-dyx"/>
<constraint firstItem="vTe-w6-DGJ" firstAttribute="leading" secondItem="kh9-bI-dsS" secondAttribute="leading" id="tT4-P0-3Wh"/>
</constraints>
Expand All @@ -42,6 +53,10 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="138" y="124"/>
</scene>
</scenes>
<resources>
<image name="playpause.fill" catalog="system" width="64" height="36"/>
</resources>
</document>
56 changes: 42 additions & 14 deletions Example/GPVideoPlayer/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,53 @@ import UIKit
import GPVideoPlayer

class ViewController: UIViewController {
@IBOutlet weak var mediaView: UIView!

@IBOutlet weak var mediaView: UIView?

private var player: GPVideoPlayer?

override func viewDidLoad() {
super.viewDidLoad()

if let player = GPVideoPlayer.initialize(with: self.mediaView.bounds) {
player.isToShowPlaybackControls = true

self.mediaView.addSubview(player)

let url1 = URL(string: "https://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4")!
let videoFilePath = Bundle.main.path(forResource: "video", ofType: "mp4")
let url2 = URL(fileURLWithPath: videoFilePath!)

player.loadVideos(with: [url1, url2])
player.isToShowPlaybackControls = true
player.isMuted = true
player.playVideo()
// if let player = GPVideoPlayer.initialize(with: self.mediaView.bounds) {
// player.isToShowPlaybackControls = true
//
// self.mediaView.addSubview(player)
//
// let url1 = URL(string: "https://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4")!
// let videoFilePath = Bundle.main.path(forResource: "video", ofType: "mp4")
// let url2 = URL(fileURLWithPath: videoFilePath!)
//
// player.loadVideos(with: [url1])
// player.isToShowPlaybackControls = true
// player.isMuted = true
// player.playVideo()
// }

//1. Create a URL
let url: String? = "https://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"
guard let streamString = url, let streamURL = URL(string: streamString) else {
return
}
print(streamURL.absoluteString)
//2. Create PlayerLayer frame
guard let frame = self.mediaView?.bounds else {
return
}
player = GPVideoPlayer.initialize(with: frame)
guard player != nil else {
return
}
self.mediaView?.addSubview(player ?? UIView())

player?.isToShowPlaybackControls = true
player?.loadVideos(with: [streamURL])
player?.isMuted = true
}

@IBAction func mediaPlayButtonPressed(_ sender: Any) {
player?.playVideo()
}

}

13 changes: 8 additions & 5 deletions Example/Pods/Pods.xcodeproj/project.pbxproj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions GPVideoPlayer.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@

Pod::Spec.new do |s|
s.name = 'GPVideoPlayer'
s.version = '1.0.4'
s.summary = "A video player with custom playback controls"
s.version = '1.0.5'
s.summary = "A video player with custom playback controls"
s.description = <<-DESC
A video player with custom playback controls
DESC

s.homepage = 'https://github.com/pgpt10/GPVideoPlayer'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.platform = :ios, "10.0"
s.platform = :ios, "10.0"
s.author = { 'pgpt10' => 'p.gpt10@gmail.com' }
s.source = { :git => 'https://github.com/pgpt10/GPVideoPlayer.git', :tag => s.version.to_s }
s.ios.deployment_target = '10.0'
s.source_files = 'GPVideoPlayer/Classes/**/*'
s.resources = 'GPVideoPlayer/Assets/*.xcassets'
s.swift_version = "4.2"
s.swift_version = "5.0"

end
Loading