├── HDLiveStreamingDemo ├── HDLiveStreamingDemo.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── HDLiveStreamingDemo.xcscmblueprint │ │ └── xcuserdata │ │ │ └── wuyiqi.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── wuyiqi.xcuserdatad │ │ └── xcschemes │ │ ├── HDLiveStreamingDemo.xcscheme │ │ └── xcschememanagement.plist └── HDLiveStreamingDemo │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard │ ├── CastViewController.h │ ├── CastViewController.mm │ ├── CastViewController.xib │ ├── HomeNavViewController.h │ ├── HomeNavViewController.m │ ├── Images.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── 直播-icon-120.png │ │ ├── 直播-icon-121.png │ │ ├── 直播-icon-80.png │ │ └── 直播-icon-81.png │ └── Contents.json │ ├── Info.plist │ ├── LivePredefine.h │ ├── LiveSettingTableViewController.h │ ├── LiveSettingTableViewController.m │ ├── ViewController.h │ ├── ViewController.m │ ├── include │ └── HardLiveStreamingSdk │ │ └── HardLiveStreamingSdk.h │ ├── libHardLiveStreamingSdk.a │ ├── main.m │ └── xfb │ ├── Reachability.h │ └── Reachability.m └── README.md /HDLiveStreamingDemo/HDLiveStreamingDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | E1ADF9E81D0817490062FA66 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E1ADF9E71D0817490062FA66 /* main.m */; }; 11 | E1ADF9EB1D0817490062FA66 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E1ADF9EA1D0817490062FA66 /* AppDelegate.m */; }; 12 | E1ADF9EE1D0817490062FA66 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E1ADF9ED1D0817490062FA66 /* ViewController.m */; }; 13 | E1ADF9F11D0817490062FA66 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E1ADF9EF1D0817490062FA66 /* Main.storyboard */; }; 14 | E1ADF9F31D0817490062FA66 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E1ADF9F21D0817490062FA66 /* Assets.xcassets */; }; 15 | E1ADFA131D0817B20062FA66 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E1ADF9FD1D0817B20062FA66 /* Assets.xcassets */; }; 16 | E1ADFA141D0817B20062FA66 /* libHardLiveStreamingSdk.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E1ADF9FE1D0817B20062FA66 /* libHardLiveStreamingSdk.a */; }; 17 | E1ADFA151D0817B20062FA66 /* CastViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1ADF9FF1D0817B20062FA66 /* CastViewController.mm */; }; 18 | E1ADFA161D0817B20062FA66 /* LiveSettingTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E1ADFA001D0817B20062FA66 /* LiveSettingTableViewController.m */; }; 19 | E1ADFA171D0817B20062FA66 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = E1ADFA061D0817B20062FA66 /* LaunchScreen.xib */; }; 20 | E1ADFA181D0817B20062FA66 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E1ADFA081D0817B20062FA66 /* Main.storyboard */; }; 21 | E1ADFA191D0817B20062FA66 /* Reachability.m in Sources */ = {isa = PBXBuildFile; fileRef = E1ADFA0D1D0817B20062FA66 /* Reachability.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; 22 | E1ADFA1A1D0817B20062FA66 /* CastViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E1ADFA0E1D0817B20062FA66 /* CastViewController.xib */; }; 23 | E1ADFA1B1D0817B20062FA66 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E1ADFA0F1D0817B20062FA66 /* Images.xcassets */; }; 24 | E1ADFA1C1D0817B20062FA66 /* HomeNavViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E1ADFA101D0817B20062FA66 /* HomeNavViewController.m */; }; 25 | E1ADFA1E1D0818050062FA66 /* VideoToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E1ADFA1D1D0818050062FA66 /* VideoToolbox.framework */; }; 26 | E1ADFA201D0818140062FA66 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E1ADFA1F1D0818140062FA66 /* AVFoundation.framework */; }; 27 | E1ADFA221D08181D0062FA66 /* libbz2.1.0.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = E1ADFA211D08181D0062FA66 /* libbz2.1.0.tbd */; }; 28 | E1ADFA241D0818290062FA66 /* libiconv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = E1ADFA231D0818290062FA66 /* libiconv.tbd */; }; 29 | E1ADFA261D0818470062FA66 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E1ADFA251D0818470062FA66 /* AudioToolbox.framework */; }; 30 | E1ADFA281D0818640062FA66 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = E1ADFA271D0818640062FA66 /* libz.tbd */; }; 31 | /* End PBXBuildFile section */ 32 | 33 | /* Begin PBXFileReference section */ 34 | E1ADF9E31D0817490062FA66 /* HDLiveStreamingDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HDLiveStreamingDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 35 | E1ADF9E71D0817490062FA66 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 36 | E1ADF9E91D0817490062FA66 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 37 | E1ADF9EA1D0817490062FA66 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 38 | E1ADF9EC1D0817490062FA66 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 39 | E1ADF9ED1D0817490062FA66 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 40 | E1ADF9F01D0817490062FA66 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 41 | E1ADF9F21D0817490062FA66 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 42 | E1ADF9F71D0817490062FA66 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 43 | E1ADF9FD1D0817B20062FA66 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 44 | E1ADF9FE1D0817B20062FA66 /* libHardLiveStreamingSdk.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libHardLiveStreamingSdk.a; sourceTree = ""; }; 45 | E1ADF9FF1D0817B20062FA66 /* CastViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CastViewController.mm; sourceTree = ""; }; 46 | E1ADFA001D0817B20062FA66 /* LiveSettingTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LiveSettingTableViewController.m; sourceTree = ""; }; 47 | E1ADFA011D0817B20062FA66 /* LivePredefine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LivePredefine.h; sourceTree = ""; }; 48 | E1ADFA041D0817B20062FA66 /* HardLiveStreamingSdk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HardLiveStreamingSdk.h; sourceTree = ""; }; 49 | E1ADFA071D0817B20062FA66 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = LaunchScreen.xib; sourceTree = ""; }; 50 | E1ADFA091D0817B20062FA66 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Main.storyboard; sourceTree = ""; }; 51 | E1ADFA0A1D0817B20062FA66 /* CastViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CastViewController.h; sourceTree = ""; }; 52 | E1ADFA0C1D0817B20062FA66 /* Reachability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Reachability.h; sourceTree = ""; }; 53 | E1ADFA0D1D0817B20062FA66 /* Reachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Reachability.m; sourceTree = ""; }; 54 | E1ADFA0E1D0817B20062FA66 /* CastViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CastViewController.xib; sourceTree = ""; }; 55 | E1ADFA0F1D0817B20062FA66 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 56 | E1ADFA101D0817B20062FA66 /* HomeNavViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HomeNavViewController.m; sourceTree = ""; }; 57 | E1ADFA111D0817B20062FA66 /* HomeNavViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HomeNavViewController.h; sourceTree = ""; }; 58 | E1ADFA121D0817B20062FA66 /* LiveSettingTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LiveSettingTableViewController.h; sourceTree = ""; }; 59 | E1ADFA1D1D0818050062FA66 /* VideoToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = VideoToolbox.framework; path = System/Library/Frameworks/VideoToolbox.framework; sourceTree = SDKROOT; }; 60 | E1ADFA1F1D0818140062FA66 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; 61 | E1ADFA211D08181D0062FA66 /* libbz2.1.0.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libbz2.1.0.tbd; path = usr/lib/libbz2.1.0.tbd; sourceTree = SDKROOT; }; 62 | E1ADFA231D0818290062FA66 /* libiconv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libiconv.tbd; path = usr/lib/libiconv.tbd; sourceTree = SDKROOT; }; 63 | E1ADFA251D0818470062FA66 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; 64 | E1ADFA271D0818640062FA66 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; 65 | /* End PBXFileReference section */ 66 | 67 | /* Begin PBXFrameworksBuildPhase section */ 68 | E1ADF9E01D0817490062FA66 /* Frameworks */ = { 69 | isa = PBXFrameworksBuildPhase; 70 | buildActionMask = 2147483647; 71 | files = ( 72 | E1ADFA281D0818640062FA66 /* libz.tbd in Frameworks */, 73 | E1ADFA261D0818470062FA66 /* AudioToolbox.framework in Frameworks */, 74 | E1ADFA241D0818290062FA66 /* libiconv.tbd in Frameworks */, 75 | E1ADFA221D08181D0062FA66 /* libbz2.1.0.tbd in Frameworks */, 76 | E1ADFA201D0818140062FA66 /* AVFoundation.framework in Frameworks */, 77 | E1ADFA1E1D0818050062FA66 /* VideoToolbox.framework in Frameworks */, 78 | E1ADFA141D0817B20062FA66 /* libHardLiveStreamingSdk.a in Frameworks */, 79 | ); 80 | runOnlyForDeploymentPostprocessing = 0; 81 | }; 82 | /* End PBXFrameworksBuildPhase section */ 83 | 84 | /* Begin PBXGroup section */ 85 | E1ADF9DA1D0817490062FA66 = { 86 | isa = PBXGroup; 87 | children = ( 88 | E1ADFA271D0818640062FA66 /* libz.tbd */, 89 | E1ADFA251D0818470062FA66 /* AudioToolbox.framework */, 90 | E1ADFA231D0818290062FA66 /* libiconv.tbd */, 91 | E1ADFA211D08181D0062FA66 /* libbz2.1.0.tbd */, 92 | E1ADFA1F1D0818140062FA66 /* AVFoundation.framework */, 93 | E1ADFA1D1D0818050062FA66 /* VideoToolbox.framework */, 94 | E1ADF9E51D0817490062FA66 /* HDLiveStreamingDemo */, 95 | E1ADF9E41D0817490062FA66 /* Products */, 96 | ); 97 | sourceTree = ""; 98 | }; 99 | E1ADF9E41D0817490062FA66 /* Products */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | E1ADF9E31D0817490062FA66 /* HDLiveStreamingDemo.app */, 103 | ); 104 | name = Products; 105 | sourceTree = ""; 106 | }; 107 | E1ADF9E51D0817490062FA66 /* HDLiveStreamingDemo */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | E1ADF9FD1D0817B20062FA66 /* Assets.xcassets */, 111 | E1ADF9FE1D0817B20062FA66 /* libHardLiveStreamingSdk.a */, 112 | E1ADF9FF1D0817B20062FA66 /* CastViewController.mm */, 113 | E1ADFA011D0817B20062FA66 /* LivePredefine.h */, 114 | E1ADFA021D0817B20062FA66 /* include */, 115 | E1ADFA051D0817B20062FA66 /* Base.lproj */, 116 | E1ADFA0A1D0817B20062FA66 /* CastViewController.h */, 117 | E1ADFA0B1D0817B20062FA66 /* xfb */, 118 | E1ADFA0E1D0817B20062FA66 /* CastViewController.xib */, 119 | E1ADFA0F1D0817B20062FA66 /* Images.xcassets */, 120 | E1ADFA101D0817B20062FA66 /* HomeNavViewController.m */, 121 | E1ADFA111D0817B20062FA66 /* HomeNavViewController.h */, 122 | E1ADFA121D0817B20062FA66 /* LiveSettingTableViewController.h */, 123 | E1ADFA001D0817B20062FA66 /* LiveSettingTableViewController.m */, 124 | E1ADF9E91D0817490062FA66 /* AppDelegate.h */, 125 | E1ADF9EA1D0817490062FA66 /* AppDelegate.m */, 126 | E1ADF9EC1D0817490062FA66 /* ViewController.h */, 127 | E1ADF9ED1D0817490062FA66 /* ViewController.m */, 128 | E1ADF9EF1D0817490062FA66 /* Main.storyboard */, 129 | E1ADF9F21D0817490062FA66 /* Assets.xcassets */, 130 | E1ADF9F71D0817490062FA66 /* Info.plist */, 131 | E1ADF9E61D0817490062FA66 /* Supporting Files */, 132 | ); 133 | path = HDLiveStreamingDemo; 134 | sourceTree = ""; 135 | }; 136 | E1ADF9E61D0817490062FA66 /* Supporting Files */ = { 137 | isa = PBXGroup; 138 | children = ( 139 | E1ADF9E71D0817490062FA66 /* main.m */, 140 | ); 141 | name = "Supporting Files"; 142 | sourceTree = ""; 143 | }; 144 | E1ADFA021D0817B20062FA66 /* include */ = { 145 | isa = PBXGroup; 146 | children = ( 147 | E1ADFA031D0817B20062FA66 /* HardLiveStreamingSdk */, 148 | ); 149 | path = include; 150 | sourceTree = ""; 151 | }; 152 | E1ADFA031D0817B20062FA66 /* HardLiveStreamingSdk */ = { 153 | isa = PBXGroup; 154 | children = ( 155 | E1ADFA041D0817B20062FA66 /* HardLiveStreamingSdk.h */, 156 | ); 157 | path = HardLiveStreamingSdk; 158 | sourceTree = ""; 159 | }; 160 | E1ADFA051D0817B20062FA66 /* Base.lproj */ = { 161 | isa = PBXGroup; 162 | children = ( 163 | E1ADFA061D0817B20062FA66 /* LaunchScreen.xib */, 164 | E1ADFA081D0817B20062FA66 /* Main.storyboard */, 165 | ); 166 | path = Base.lproj; 167 | sourceTree = ""; 168 | }; 169 | E1ADFA0B1D0817B20062FA66 /* xfb */ = { 170 | isa = PBXGroup; 171 | children = ( 172 | E1ADFA0C1D0817B20062FA66 /* Reachability.h */, 173 | E1ADFA0D1D0817B20062FA66 /* Reachability.m */, 174 | ); 175 | path = xfb; 176 | sourceTree = ""; 177 | }; 178 | /* End PBXGroup section */ 179 | 180 | /* Begin PBXNativeTarget section */ 181 | E1ADF9E21D0817490062FA66 /* HDLiveStreamingDemo */ = { 182 | isa = PBXNativeTarget; 183 | buildConfigurationList = E1ADF9FA1D0817490062FA66 /* Build configuration list for PBXNativeTarget "HDLiveStreamingDemo" */; 184 | buildPhases = ( 185 | E1ADF9DF1D0817490062FA66 /* Sources */, 186 | E1ADF9E01D0817490062FA66 /* Frameworks */, 187 | E1ADF9E11D0817490062FA66 /* Resources */, 188 | ); 189 | buildRules = ( 190 | ); 191 | dependencies = ( 192 | ); 193 | name = HDLiveStreamingDemo; 194 | productName = HDLiveStreamingDemo; 195 | productReference = E1ADF9E31D0817490062FA66 /* HDLiveStreamingDemo.app */; 196 | productType = "com.apple.product-type.application"; 197 | }; 198 | /* End PBXNativeTarget section */ 199 | 200 | /* Begin PBXProject section */ 201 | E1ADF9DB1D0817490062FA66 /* Project object */ = { 202 | isa = PBXProject; 203 | attributes = { 204 | LastUpgradeCheck = 0730; 205 | ORGANIZATIONNAME = doulai; 206 | TargetAttributes = { 207 | E1ADF9E21D0817490062FA66 = { 208 | CreatedOnToolsVersion = 7.3.1; 209 | }; 210 | }; 211 | }; 212 | buildConfigurationList = E1ADF9DE1D0817490062FA66 /* Build configuration list for PBXProject "HDLiveStreamingDemo" */; 213 | compatibilityVersion = "Xcode 3.2"; 214 | developmentRegion = English; 215 | hasScannedForEncodings = 0; 216 | knownRegions = ( 217 | en, 218 | Base, 219 | ); 220 | mainGroup = E1ADF9DA1D0817490062FA66; 221 | productRefGroup = E1ADF9E41D0817490062FA66 /* Products */; 222 | projectDirPath = ""; 223 | projectRoot = ""; 224 | targets = ( 225 | E1ADF9E21D0817490062FA66 /* HDLiveStreamingDemo */, 226 | ); 227 | }; 228 | /* End PBXProject section */ 229 | 230 | /* Begin PBXResourcesBuildPhase section */ 231 | E1ADF9E11D0817490062FA66 /* Resources */ = { 232 | isa = PBXResourcesBuildPhase; 233 | buildActionMask = 2147483647; 234 | files = ( 235 | E1ADFA171D0817B20062FA66 /* LaunchScreen.xib in Resources */, 236 | E1ADFA1B1D0817B20062FA66 /* Images.xcassets in Resources */, 237 | E1ADFA1A1D0817B20062FA66 /* CastViewController.xib in Resources */, 238 | E1ADF9F31D0817490062FA66 /* Assets.xcassets in Resources */, 239 | E1ADFA181D0817B20062FA66 /* Main.storyboard in Resources */, 240 | E1ADFA131D0817B20062FA66 /* Assets.xcassets in Resources */, 241 | E1ADF9F11D0817490062FA66 /* Main.storyboard in Resources */, 242 | ); 243 | runOnlyForDeploymentPostprocessing = 0; 244 | }; 245 | /* End PBXResourcesBuildPhase section */ 246 | 247 | /* Begin PBXSourcesBuildPhase section */ 248 | E1ADF9DF1D0817490062FA66 /* Sources */ = { 249 | isa = PBXSourcesBuildPhase; 250 | buildActionMask = 2147483647; 251 | files = ( 252 | E1ADF9EE1D0817490062FA66 /* ViewController.m in Sources */, 253 | E1ADF9EB1D0817490062FA66 /* AppDelegate.m in Sources */, 254 | E1ADF9E81D0817490062FA66 /* main.m in Sources */, 255 | E1ADFA161D0817B20062FA66 /* LiveSettingTableViewController.m in Sources */, 256 | E1ADFA1C1D0817B20062FA66 /* HomeNavViewController.m in Sources */, 257 | E1ADFA191D0817B20062FA66 /* Reachability.m in Sources */, 258 | E1ADFA151D0817B20062FA66 /* CastViewController.mm in Sources */, 259 | ); 260 | runOnlyForDeploymentPostprocessing = 0; 261 | }; 262 | /* End PBXSourcesBuildPhase section */ 263 | 264 | /* Begin PBXVariantGroup section */ 265 | E1ADF9EF1D0817490062FA66 /* Main.storyboard */ = { 266 | isa = PBXVariantGroup; 267 | children = ( 268 | E1ADF9F01D0817490062FA66 /* Base */, 269 | ); 270 | name = Main.storyboard; 271 | sourceTree = ""; 272 | }; 273 | E1ADFA061D0817B20062FA66 /* LaunchScreen.xib */ = { 274 | isa = PBXVariantGroup; 275 | children = ( 276 | E1ADFA071D0817B20062FA66 /* Base */, 277 | ); 278 | name = LaunchScreen.xib; 279 | sourceTree = ""; 280 | }; 281 | E1ADFA081D0817B20062FA66 /* Main.storyboard */ = { 282 | isa = PBXVariantGroup; 283 | children = ( 284 | E1ADFA091D0817B20062FA66 /* Base */, 285 | ); 286 | name = Main.storyboard; 287 | sourceTree = ""; 288 | }; 289 | /* End PBXVariantGroup section */ 290 | 291 | /* Begin XCBuildConfiguration section */ 292 | E1ADF9F81D0817490062FA66 /* Debug */ = { 293 | isa = XCBuildConfiguration; 294 | buildSettings = { 295 | ALWAYS_SEARCH_USER_PATHS = NO; 296 | CLANG_ANALYZER_NONNULL = YES; 297 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 298 | CLANG_CXX_LIBRARY = "libc++"; 299 | CLANG_ENABLE_MODULES = YES; 300 | CLANG_ENABLE_OBJC_ARC = YES; 301 | CLANG_WARN_BOOL_CONVERSION = YES; 302 | CLANG_WARN_CONSTANT_CONVERSION = YES; 303 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 304 | CLANG_WARN_EMPTY_BODY = YES; 305 | CLANG_WARN_ENUM_CONVERSION = YES; 306 | CLANG_WARN_INT_CONVERSION = YES; 307 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 308 | CLANG_WARN_UNREACHABLE_CODE = YES; 309 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 310 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 311 | COPY_PHASE_STRIP = NO; 312 | DEBUG_INFORMATION_FORMAT = dwarf; 313 | ENABLE_STRICT_OBJC_MSGSEND = YES; 314 | ENABLE_TESTABILITY = YES; 315 | GCC_C_LANGUAGE_STANDARD = gnu99; 316 | GCC_DYNAMIC_NO_PIC = NO; 317 | GCC_NO_COMMON_BLOCKS = YES; 318 | GCC_OPTIMIZATION_LEVEL = 0; 319 | GCC_PREPROCESSOR_DEFINITIONS = ( 320 | "DEBUG=1", 321 | "$(inherited)", 322 | ); 323 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 324 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 325 | GCC_WARN_UNDECLARED_SELECTOR = YES; 326 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 327 | GCC_WARN_UNUSED_FUNCTION = YES; 328 | GCC_WARN_UNUSED_VARIABLE = YES; 329 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 330 | MTL_ENABLE_DEBUG_INFO = YES; 331 | ONLY_ACTIVE_ARCH = YES; 332 | SDKROOT = iphoneos; 333 | TARGETED_DEVICE_FAMILY = "1,2"; 334 | }; 335 | name = Debug; 336 | }; 337 | E1ADF9F91D0817490062FA66 /* Release */ = { 338 | isa = XCBuildConfiguration; 339 | buildSettings = { 340 | ALWAYS_SEARCH_USER_PATHS = NO; 341 | CLANG_ANALYZER_NONNULL = YES; 342 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 343 | CLANG_CXX_LIBRARY = "libc++"; 344 | CLANG_ENABLE_MODULES = YES; 345 | CLANG_ENABLE_OBJC_ARC = YES; 346 | CLANG_WARN_BOOL_CONVERSION = YES; 347 | CLANG_WARN_CONSTANT_CONVERSION = YES; 348 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 349 | CLANG_WARN_EMPTY_BODY = YES; 350 | CLANG_WARN_ENUM_CONVERSION = YES; 351 | CLANG_WARN_INT_CONVERSION = YES; 352 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 353 | CLANG_WARN_UNREACHABLE_CODE = YES; 354 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 355 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 356 | COPY_PHASE_STRIP = NO; 357 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 358 | ENABLE_NS_ASSERTIONS = NO; 359 | ENABLE_STRICT_OBJC_MSGSEND = YES; 360 | GCC_C_LANGUAGE_STANDARD = gnu99; 361 | GCC_NO_COMMON_BLOCKS = YES; 362 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 363 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 364 | GCC_WARN_UNDECLARED_SELECTOR = YES; 365 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 366 | GCC_WARN_UNUSED_FUNCTION = YES; 367 | GCC_WARN_UNUSED_VARIABLE = YES; 368 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 369 | MTL_ENABLE_DEBUG_INFO = NO; 370 | SDKROOT = iphoneos; 371 | TARGETED_DEVICE_FAMILY = "1,2"; 372 | VALIDATE_PRODUCT = YES; 373 | }; 374 | name = Release; 375 | }; 376 | E1ADF9FB1D0817490062FA66 /* Debug */ = { 377 | isa = XCBuildConfiguration; 378 | buildSettings = { 379 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 380 | ENABLE_BITCODE = NO; 381 | INFOPLIST_FILE = HDLiveStreamingDemo/Info.plist; 382 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 383 | LIBRARY_SEARCH_PATHS = ( 384 | "$(inherited)", 385 | "$(PROJECT_DIR)/HDLiveStreamingDemo", 386 | ); 387 | PRODUCT_BUNDLE_IDENTIFIER = com.hj.HDLiveStreamingDemo; 388 | PRODUCT_NAME = "$(TARGET_NAME)"; 389 | }; 390 | name = Debug; 391 | }; 392 | E1ADF9FC1D0817490062FA66 /* Release */ = { 393 | isa = XCBuildConfiguration; 394 | buildSettings = { 395 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 396 | ENABLE_BITCODE = NO; 397 | INFOPLIST_FILE = HDLiveStreamingDemo/Info.plist; 398 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 399 | LIBRARY_SEARCH_PATHS = ( 400 | "$(inherited)", 401 | "$(PROJECT_DIR)/HDLiveStreamingDemo", 402 | ); 403 | PRODUCT_BUNDLE_IDENTIFIER = com.hj.HDLiveStreamingDemo; 404 | PRODUCT_NAME = "$(TARGET_NAME)"; 405 | }; 406 | name = Release; 407 | }; 408 | /* End XCBuildConfiguration section */ 409 | 410 | /* Begin XCConfigurationList section */ 411 | E1ADF9DE1D0817490062FA66 /* Build configuration list for PBXProject "HDLiveStreamingDemo" */ = { 412 | isa = XCConfigurationList; 413 | buildConfigurations = ( 414 | E1ADF9F81D0817490062FA66 /* Debug */, 415 | E1ADF9F91D0817490062FA66 /* Release */, 416 | ); 417 | defaultConfigurationIsVisible = 0; 418 | defaultConfigurationName = Release; 419 | }; 420 | E1ADF9FA1D0817490062FA66 /* Build configuration list for PBXNativeTarget "HDLiveStreamingDemo" */ = { 421 | isa = XCConfigurationList; 422 | buildConfigurations = ( 423 | E1ADF9FB1D0817490062FA66 /* Debug */, 424 | E1ADF9FC1D0817490062FA66 /* Release */, 425 | ); 426 | defaultConfigurationIsVisible = 0; 427 | defaultConfigurationName = Release; 428 | }; 429 | /* End XCConfigurationList section */ 430 | }; 431 | rootObject = E1ADF9DB1D0817490062FA66 /* Project object */; 432 | } 433 | -------------------------------------------------------------------------------- /HDLiveStreamingDemo/HDLiveStreamingDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /HDLiveStreamingDemo/HDLiveStreamingDemo.xcodeproj/project.xcworkspace/xcshareddata/HDLiveStreamingDemo.xcscmblueprint: -------------------------------------------------------------------------------- 1 | { 2 | "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "c533ac5c-e93d-bf77-205b-ce57b7db7bff++505", 3 | "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : { 4 | "c533ac5c-e93d-bf77-205b-ce57b7db7bff++505" : { 5 | 6 | } 7 | }, 8 | "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : { 9 | "c533ac5c-e93d-bf77-205b-ce57b7db7bff++505" : 0 10 | }, 11 | "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "E90B0652-4955-45B4-8DC8-D605E68E72DD", 12 | "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : { 13 | "c533ac5c-e93d-bf77-205b-ce57b7db7bff++505" : "HDLiveStreamingSdk\/" 14 | }, 15 | "DVTSourceControlWorkspaceBlueprintNameKey" : "HDLiveStreamingDemo", 16 | "DVTSourceControlWorkspaceBlueprintVersion" : 204, 17 | "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "HDLiveStreamingDemo\/HDLiveStreamingDemo.xcodeproj", 18 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [ 19 | { 20 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/newOcean\/HDLiveStreamingSdk", 21 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Subversion", 22 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "c533ac5c-e93d-bf77-205b-ce57b7db7bff++505" 23 | } 24 | ] 25 | } -------------------------------------------------------------------------------- /HDLiveStreamingDemo/HDLiveStreamingDemo.xcodeproj/project.xcworkspace/xcuserdata/wuyiqi.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newOcean/HDLiveStreamingSdk/1653c720c6e02953234c295fa13fbaf6752f2ca9/HDLiveStreamingDemo/HDLiveStreamingDemo.xcodeproj/project.xcworkspace/xcuserdata/wuyiqi.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /HDLiveStreamingDemo/HDLiveStreamingDemo.xcodeproj/xcuserdata/wuyiqi.xcuserdatad/xcschemes/HDLiveStreamingDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /HDLiveStreamingDemo/HDLiveStreamingDemo.xcodeproj/xcuserdata/wuyiqi.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | HDLiveStreamingDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | E1ADF9E21D0817490062FA66 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /HDLiveStreamingDemo/HDLiveStreamingDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // HDLive 4 | // 5 | // Created by doulai on 2/18/16. 6 | // Copyright (c) 2016 doulai. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /HDLiveStreamingDemo/HDLiveStreamingDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // HDLive 4 | // 5 | // Created by doulai on 2/18/16. 6 | // Copyright (c) 2016 doulai. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | #import "LivePredefine.h" 12 | 13 | @interface AppDelegate () 14 | { 15 | } 16 | @end 17 | 18 | @implementation AppDelegate 19 | 20 | 21 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 22 | // Override point for customization after application launch. 23 | [self appearanceConfig]; 24 | 25 | NSNumber *videosetting =[[NSUserDefaults standardUserDefaults] objectForKey:kVIDEOQUALITY]; 26 | if (!videosetting) { 27 | videosetting =@2; 28 | [[NSUserDefaults standardUserDefaults] setObject:videosetting forKey:kVIDEOQUALITY]; 29 | } 30 | return YES; 31 | } 32 | - (void)appearanceConfig 33 | { 34 | // if (IOS7_OR_LATER) 35 | { // 判断是否是IOS7 36 | [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:NO]; 37 | } 38 | [UINavigationBar appearance].tintColor = [UIColor whiteColor]; 39 | [[UINavigationBar appearance] setBackgroundImage:[self statusBar] forBarMetrics:UIBarMetricsDefault]; 40 | [[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor],NSFontAttributeName:[UIFont boldSystemFontOfSize:18.]}]; 41 | } 42 | 43 | - (UIImage *)statusBar 44 | { 45 | UIImage *image; 46 | UIGraphicsBeginImageContext(CGSizeMake([UIScreen mainScreen].bounds.size.width, 20.)); 47 | UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 20.)]; 48 | CAGradientLayer *gradientLayer1 = [CAGradientLayer layer]; 49 | gradientLayer1.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 20.); 50 | [gradientLayer1 setColors:@[(id)[UIColor blueColor].CGColor,(id)[UIColor purpleColor].CGColor]]; 51 | // [gradientLayer1 setColors:@[(id)[UIColor colorWithRed:21 green:55 blue:114 alpha:1].CGColor,(id)[UIColor colorWithRed:21 green:55 blue:114 alpha:1].CGColor]]; 52 | [gradientLayer1 setStartPoint:CGPointMake(0, 0)]; 53 | [gradientLayer1 setEndPoint:CGPointMake(1, 0)]; 54 | [view.layer addSublayer:gradientLayer1]; 55 | [view.layer renderInContext:UIGraphicsGetCurrentContext()]; 56 | image = UIGraphicsGetImageFromCurrentImageContext(); 57 | UIGraphicsEndImageContext(); 58 | return image; 59 | } 60 | - (void)applicationWillResignActive:(UIApplication *)application { 61 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 62 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 63 | } 64 | 65 | - (void)applicationDidEnterBackground:(UIApplication *)application { 66 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 67 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 68 | } 69 | 70 | - (void)applicationWillEnterForeground:(UIApplication *)application { 71 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 72 | } 73 | 74 | - (void)applicationDidBecomeActive:(UIApplication *)application { 75 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 76 | } 77 | 78 | - (void)applicationWillTerminate:(UIApplication *)application { 79 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 80 | } 81 | 82 | @end 83 | -------------------------------------------------------------------------------- /HDLiveStreamingDemo/HDLiveStreamingDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /HDLiveStreamingDemo/HDLiveStreamingDemo/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /HDLiveStreamingDemo/HDLiveStreamingDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /HDLiveStreamingDemo/HDLiveStreamingDemo/CastViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CastViewController.h 3 | // HDLive 4 | // 5 | // Created by doulai on 2/22/16. 6 | // Copyright © 2016 doulai. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CastViewController : UIViewController 12 | @property (nonatomic,strong) NSString *uploadUrl; 13 | //@property (nonatomic,strong) NSString* roomid; 14 | @end 15 | -------------------------------------------------------------------------------- /HDLiveStreamingDemo/HDLiveStreamingDemo/CastViewController.mm: -------------------------------------------------------------------------------- 1 | // 2 | // CastViewController.m 3 | // HDLive 4 | // 5 | // Created by doulai on 2/22/16. 6 | // Copyright © 2016 doulai. All rights reserved. 7 | // 8 | 9 | #import "CastViewController.h" 10 | #import "HardLiveStreamingSdk.h" 11 | #import "LivePredefine.h" 12 | //#import "NetworkTask.h" 13 | #import "Reachability.h" 14 | //#import "XFBPredefine.h" 15 | @interface CastViewController () 16 | { 17 | HardLiveStreamingSdk *livesdk; 18 | NSTimer *timer; 19 | NSTimer *startTimer; 20 | UIView *startView; 21 | int eclipetime ; 22 | NSTimeInterval starttime; 23 | double bitratesum; 24 | //tap 25 | UITapGestureRecognizer *tapR; 26 | UIView *tapView; 27 | BOOL btnstates[6]; 28 | 29 | NSArray *imgNormalName; 30 | NSArray *imgSelectedName; 31 | 32 | } 33 | 34 | @end 35 | 36 | @implementation CastViewController 37 | 38 | - (void)viewDidLoad { 39 | [super viewDidLoad]; 40 | // Do any additional setup after loading the view from its nib. 41 | livesdk =[[HardLiveStreamingSdk alloc] init]; 42 | livesdk.delegate =self; 43 | livesdk.encoderType =0;//软编码,1,2为硬编码 44 | bitratesum =0; 45 | 46 | 47 | imgNormalName =@[@"麦克风",@"禁止闪光灯",@"切换摄像头",@"聚焦",@"播放"]; 48 | imgSelectedName =@[@"禁止麦克风",@"闪光灯",@"切换摄像头",@"聚焦",@"播放"]; 49 | for (int i =0 ; i<6; i++) { 50 | btnstates[i] =NO; 51 | 52 | } 53 | 54 | for (int i=1; i<6; i++) { 55 | UIButton *tmp =[self.view viewWithTag:(i)]; 56 | [tmp setBackgroundImage:[UIImage imageNamed:imgNormalName[i-1]] forState:UIControlStateNormal]; 57 | } 58 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillResignActive:) 59 | name:UIApplicationWillResignActiveNotification object:nil]; //监听是否触发home键挂起程序. 60 | } 61 | -(void)viewDidAppear:(BOOL)animated{ 62 | eclipetime =2; 63 | startTimer =[NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(timerStart:) userInfo:nil repeats:YES]; 64 | NSNumber *qulity =[[NSUserDefaults standardUserDefaults] objectForKey:kVIDEOQUALITY]; 65 | NSArray *choosed =VIDEO_QUALITY_LIST[[qulity integerValue]]; 66 | NSNumber* w =choosed[1] ; 67 | NSNumber *h =choosed[2] ; 68 | NSNumber *br =choosed[3]; 69 | NSNumber *daikuan = [[NSUserDefaults standardUserDefaults] objectForKey:kVIDEOBitratecontrol]; 70 | if ([daikuan integerValue]==1) { 71 | br =@0; 72 | } 73 | 74 | // 开始预览 75 | [livesdk lib_doulai_record_start_preview:self.view videoWidth:[w intValue] height:[h intValue] bitrate:[br intValue]]; 76 | 77 | startView =[[UIView alloc] initWithFrame:CGRectMake(0, 0, 60, 60)]; 78 | startView.center =self.view.center; 79 | [startView setBackgroundColor:[UIColor clearColor]]; 80 | 81 | UILabel *tmp =[[UILabel alloc] initWithFrame:CGRectMake(10, 15, 40, 30)]; 82 | tmp.text =@""; 83 | [tmp setFont:[UIFont systemFontOfSize:40]]; 84 | [tmp setTextColor:[UIColor blueColor]]; 85 | [tmp setBackgroundColor:[UIColor clearColor]]; 86 | [tmp setTextAlignment:NSTextAlignmentCenter]; 87 | tmp.tag =1; 88 | // tmp.center =startView.center; 89 | [startView addSubview:tmp]; 90 | [self.view addSubview:startView]; 91 | 92 | } 93 | 94 | -(void)viewDidDisappear:(BOOL)animated{ 95 | [startTimer invalidate]; 96 | [timer invalidate]; 97 | 98 | } 99 | -(void)applicationWillResignActive:(id)sender{ 100 | [self stopLive]; 101 | [self dismissViewControllerAnimated:YES completion:nil]; 102 | } 103 | #pragma mark view init 104 | 105 | -(void)timerStart:(NSTimer*)sender{ 106 | startView.center =self.view.center; 107 | 108 | UILabel *tmp =[startView viewWithTag:1]; 109 | tmp.text =[NSString stringWithFormat:@"%d",eclipetime ]; 110 | 111 | 112 | if (eclipetime ==0) { 113 | [startTimer invalidate]; 114 | [startView removeFromSuperview]; 115 | [sender invalidate ]; 116 | 117 | starttime =[[NSDate date] timeIntervalSince1970]; 118 | 119 | 120 | [ [ UIApplication sharedApplication] setIdleTimerDisabled:YES ] ; 121 | [self performSelectorInBackground:@selector(startLiveCast) withObject:nil]; 122 | } 123 | eclipetime-= sender.timeInterval; 124 | 125 | 126 | } 127 | -(void)startLiveCast{ 128 | [livesdk lib_doulai_record_start_upload:[self.uploadUrl UTF8String]]; 129 | 130 | } 131 | - (void)didReceiveMemoryWarning { 132 | [super didReceiveMemoryWarning]; 133 | // Dispose of any resources that can be recreated. 134 | } 135 | -(void)reportFps:(int)fps bitrate:(int)bitrate width:(int)w height:(int)h ;{ 136 | 137 | UILabel *wifi =[self.view viewWithTag:10]; 138 | NSTimeInterval timelen =[[NSDate date] timeIntervalSince1970]; 139 | timelen -=starttime; 140 | NSDateFormatter *format =[[NSDateFormatter alloc] init]; 141 | if (timelen >=60*60) { 142 | [format setDateFormat:@"HH:mm:ss"]; 143 | }else 144 | [format setDateFormat:@"mm:ss"]; 145 | bitratesum +=bitrate; 146 | NSString *bitstr= [NSString stringWithFormat:@"%.2fM",bitratesum/1024.0]; 147 | 148 | NSString *timestr =[format stringFromDate:[NSDate dateWithTimeIntervalSince1970:timelen]]; 149 | NSMutableAttributedString *wifiattr =[[NSMutableAttributedString alloc] init]; 150 | NSString *wifitype =[NSString stringWithFormat: @"%@网络在线 ",[Reachability GetNetWorkType]]; 151 | [wifiattr appendAttributedString:[[NSAttributedString alloc] initWithString:wifitype attributes:@{NSForegroundColorAttributeName:[UIColor redColor]}]]; 152 | [wifiattr appendAttributedString:[[NSAttributedString alloc] initWithString:timestr attributes:@{NSForegroundColorAttributeName:[UIColor redColor]}]]; 153 | 154 | [wifiattr appendAttributedString:[[NSAttributedString alloc] initWithString:@" 流量 " attributes:@{NSForegroundColorAttributeName:[UIColor redColor]}]]; 155 | [wifiattr appendAttributedString:[[NSAttributedString alloc] initWithString:bitstr attributes:@{NSForegroundColorAttributeName:[UIColor redColor]}]]; 156 | 157 | 158 | 159 | 160 | wifi.attributedText =wifiattr; 161 | UILabel *size =[self.view viewWithTag:11]; 162 | size.text =[NSString stringWithFormat:@"size:%dx%d fps:%d br:%dkbps",w,h,fps,bitrate]; 163 | 164 | } 165 | #pragma mark button 166 | - (IBAction)stopCastPress:(UIButton *)sender { 167 | 168 | if (btnstates[sender.tag]) { 169 | btnstates[sender.tag] = NO; 170 | [sender setBackgroundImage:[UIImage imageNamed:imgNormalName[sender.tag-1]] forState:UIControlStateNormal]; 171 | }else 172 | { 173 | [sender setBackgroundImage:[UIImage imageNamed:imgSelectedName[sender.tag-1]] forState:UIControlStateNormal]; 174 | btnstates[sender.tag] =YES; 175 | } 176 | BOOL state =btnstates[sender.tag]; 177 | switch (sender.tag) { 178 | case 1:// 179 | 180 | 181 | 182 | [livesdk lib_doulai_audio_switchMute]; 183 | break; 184 | case 2: 185 | if (state) { 186 | [livesdk lib_doulai_video_setFlashMode:1]; 187 | 188 | }else 189 | { 190 | [livesdk lib_doulai_video_setFlashMode:0]; 191 | 192 | } 193 | 194 | break; 195 | case 3: 196 | [livesdk lib_doulai_video_switchCapture]; 197 | break; 198 | 199 | case 4://focus 200 | { 201 | if (state) { 202 | tapView =[[UIView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)]; 203 | [tapView setBackgroundColor:[UIColor clearColor]]; 204 | tapView.layer.borderWidth = 2; 205 | tapView.layer.borderColor = [[UIColor greenColor] CGColor]; 206 | tapView.center =self.view.center; 207 | [self.view addSubview:tapView]; 208 | tapR =[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapview:)]; 209 | [self.view addGestureRecognizer:tapR]; 210 | 211 | }else 212 | { 213 | 214 | [self.view removeGestureRecognizer:tapR]; 215 | [tapView removeFromSuperview]; 216 | } 217 | 218 | 219 | 220 | } 221 | break; 222 | case 5: 223 | { 224 | UIAlertView *alert =[[UIAlertView alloc] initWithTitle:@"是否停止直播?" message:nil delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil]; 225 | [alert show]; 226 | break; 227 | } 228 | 229 | default: 230 | break; 231 | } 232 | 233 | } 234 | 235 | 236 | -(void)stopLive{ 237 | 238 | 239 | 240 | [ [ UIApplication sharedApplication] setIdleTimerDisabled:NO ] ; 241 | [livesdk lib_doulai_record_stop_upload]; 242 | [livesdk lib_doulai_record_stop_preview]; 243 | livesdk.delegate =nil; 244 | 245 | [timer invalidate]; 246 | [startTimer invalidate]; 247 | 248 | 249 | 250 | } 251 | -(void)tapview:(UITapGestureRecognizer*)sender{ 252 | CGPoint point= [sender locationInView:self.view]; 253 | if (point.x<45+tapView.frame.size.width/2 || point.x >self.view.frame.size.width-45-tapView.frame.size.width/2) { 254 | return; 255 | } 256 | tapView.center =point; 257 | 258 | CGPoint p =CGPointMake(point.x/self.view.frame.size.width, point.y/self.view.frame.size.height); 259 | [livesdk lib_doulai_video_switchFocus:p]; 260 | } 261 | /* 262 | #pragma mark - Navigation 263 | 264 | // In a storyboard-based application, you will often want to do a little preparation before navigation 265 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 266 | // Get the new view controller using [segue destinationViewController]. 267 | // Pass the selected object to the new view controller. 268 | } 269 | */ 270 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{ 271 | NSLog(@"should orientation =%ld",(long)interfaceOrientation); 272 | 273 | return (interfaceOrientation == UIInterfaceOrientationLandscapeRight); 274 | } 275 | - (NSUInteger)supportedInterfaceOrientations 276 | { 277 | 278 | NSNumber *qulity =[[NSUserDefaults standardUserDefaults] objectForKey:kVIDEOQUALITY]; 279 | if ([qulity integerValue]==0) { 280 | return UIInterfaceOrientationMaskPortrait; 281 | } 282 | return UIInterfaceOrientationMaskLandscapeRight; 283 | } 284 | #pragma mark private 285 | - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex 286 | { 287 | if( buttonIndex ==1) 288 | { 289 | [self performSelectorInBackground:@selector(stopLive) withObject:nil]; 290 | [self dismissViewControllerAnimated:YES completion:nil]; 291 | } 292 | 293 | } 294 | 295 | 296 | 297 | @end 298 | -------------------------------------------------------------------------------- /HDLiveStreamingDemo/HDLiveStreamingDemo/CastViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 24 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 50 | 62 | 71 | 80 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /HDLiveStreamingDemo/HDLiveStreamingDemo/HomeNavViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // HomeNavViewController.h 3 | // HDLive 4 | // 5 | // Created by doulai on 3/8/16. 6 | // Copyright © 2016 doulai. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface HomeNavViewController : UINavigationController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /HDLiveStreamingDemo/HDLiveStreamingDemo/HomeNavViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // HomeNavViewController.m 3 | // HDLive 4 | // 5 | // Created by doulai on 3/8/16. 6 | // Copyright © 2016 doulai. All rights reserved. 7 | // 8 | 9 | #import "HomeNavViewController.h" 10 | 11 | @interface HomeNavViewController () 12 | 13 | @end 14 | 15 | @implementation HomeNavViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view. 20 | } 21 | 22 | - (void)didReceiveMemoryWarning { 23 | [super didReceiveMemoryWarning]; 24 | // Dispose of any resources that can be recreated. 25 | } 26 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{ 27 | NSLog(@"should orientation =%ld",(long)interfaceOrientation); 28 | 29 | return (interfaceOrientation == UIInterfaceOrientationPortrait); 30 | } 31 | 32 | 33 | - (BOOL)shouldAutorotate NS_AVAILABLE_IOS(6_0) __TVOS_PROHIBITED; 34 | { 35 | return NO; 36 | } 37 | - (UIInterfaceOrientationMask)supportedInterfaceOrientations 38 | { 39 | return UIInterfaceOrientationMaskPortrait; 40 | } 41 | /* 42 | #pragma mark - Navigation 43 | 44 | // In a storyboard-based application, you will often want to do a little preparation before navigation 45 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 46 | // Get the new view controller using [segue destinationViewController]. 47 | // Pass the selected object to the new view controller. 48 | } 49 | */ 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /HDLiveStreamingDemo/HDLiveStreamingDemo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "29x29", 5 | "idiom" : "iphone", 6 | "filename" : "直播-icon-121.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "idiom" : "iphone", 11 | "size" : "29x29", 12 | "scale" : "3x" 13 | }, 14 | { 15 | "size" : "40x40", 16 | "idiom" : "iphone", 17 | "filename" : "直播-icon-80.png", 18 | "scale" : "2x" 19 | }, 20 | { 21 | "idiom" : "iphone", 22 | "size" : "40x40", 23 | "scale" : "3x" 24 | }, 25 | { 26 | "size" : "60x60", 27 | "idiom" : "iphone", 28 | "filename" : "直播-icon-120.png", 29 | "scale" : "2x" 30 | }, 31 | { 32 | "idiom" : "iphone", 33 | "size" : "60x60", 34 | "scale" : "3x" 35 | }, 36 | { 37 | "idiom" : "ipad", 38 | "size" : "29x29", 39 | "scale" : "1x" 40 | }, 41 | { 42 | "idiom" : "ipad", 43 | "size" : "29x29", 44 | "scale" : "2x" 45 | }, 46 | { 47 | "size" : "40x40", 48 | "idiom" : "ipad", 49 | "filename" : "直播-icon-81.png", 50 | "scale" : "1x" 51 | }, 52 | { 53 | "idiom" : "ipad", 54 | "size" : "40x40", 55 | "scale" : "2x" 56 | }, 57 | { 58 | "idiom" : "ipad", 59 | "size" : "76x76", 60 | "scale" : "1x" 61 | }, 62 | { 63 | "idiom" : "ipad", 64 | "size" : "76x76", 65 | "scale" : "2x" 66 | }, 67 | { 68 | "idiom" : "ipad", 69 | "size" : "83.5x83.5", 70 | "scale" : "2x" 71 | } 72 | ], 73 | "info" : { 74 | "version" : 1, 75 | "author" : "xcode" 76 | } 77 | } -------------------------------------------------------------------------------- /HDLiveStreamingDemo/HDLiveStreamingDemo/Images.xcassets/AppIcon.appiconset/直播-icon-120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newOcean/HDLiveStreamingSdk/1653c720c6e02953234c295fa13fbaf6752f2ca9/HDLiveStreamingDemo/HDLiveStreamingDemo/Images.xcassets/AppIcon.appiconset/直播-icon-120.png -------------------------------------------------------------------------------- /HDLiveStreamingDemo/HDLiveStreamingDemo/Images.xcassets/AppIcon.appiconset/直播-icon-121.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newOcean/HDLiveStreamingSdk/1653c720c6e02953234c295fa13fbaf6752f2ca9/HDLiveStreamingDemo/HDLiveStreamingDemo/Images.xcassets/AppIcon.appiconset/直播-icon-121.png -------------------------------------------------------------------------------- /HDLiveStreamingDemo/HDLiveStreamingDemo/Images.xcassets/AppIcon.appiconset/直播-icon-80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newOcean/HDLiveStreamingSdk/1653c720c6e02953234c295fa13fbaf6752f2ca9/HDLiveStreamingDemo/HDLiveStreamingDemo/Images.xcassets/AppIcon.appiconset/直播-icon-80.png -------------------------------------------------------------------------------- /HDLiveStreamingDemo/HDLiveStreamingDemo/Images.xcassets/AppIcon.appiconset/直播-icon-81.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newOcean/HDLiveStreamingSdk/1653c720c6e02953234c295fa13fbaf6752f2ca9/HDLiveStreamingDemo/HDLiveStreamingDemo/Images.xcassets/AppIcon.appiconset/直播-icon-81.png -------------------------------------------------------------------------------- /HDLiveStreamingDemo/HDLiveStreamingDemo/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /HDLiveStreamingDemo/HDLiveStreamingDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /HDLiveStreamingDemo/HDLiveStreamingDemo/LivePredefine.h: -------------------------------------------------------------------------------- 1 | // 2 | // LivePredefine.h 3 | // HDLive 4 | // 5 | // Created by doulai on 2/19/16. 6 | // Copyright © 2016 doulai. All rights reserved. 7 | // 8 | 9 | #ifndef LivePredefine_h 10 | #define LivePredefine_h 11 | 12 | #define VIDEO_QUALITY_LIST @[@[@"竖屏",@480,@640,@80],\ 13 | @[@"标清",@352,@288,@30],\ 14 | @[@"D1 高清",@640,@480,@80],\ 15 | @[@"720P 高清",@1280,@720,@120],\ 16 | @[@"1080P 超清",@1980,@1080,@500]]\ 17 | 18 | 19 | #define VIDEO_BITRATE_CONTROL @[@"恒定速率",@"动态调节"] 20 | 21 | #define kVIDEOQUALITY @"kVideoqulity" 22 | #define kVIDEOBitratecontrol @"kVideobitratecontrol" 23 | #define kNotify_logout @"kNotify_logout" 24 | #define kNotify_login @"kNotify_login" 25 | 26 | #define BACKGROUNDCORLOR [UIColor colorWithRed:225./255. green:225./255. blue:233./255. alpha:1.] 27 | #endif /* LivePredefine_h */ 28 | -------------------------------------------------------------------------------- /HDLiveStreamingDemo/HDLiveStreamingDemo/LiveSettingTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SettingTableViewController.h 3 | // HDLive 4 | // 5 | // Created by doulai on 2/19/16. 6 | // Copyright © 2016 doulai. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LiveSettingTableViewController : UITableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /HDLiveStreamingDemo/HDLiveStreamingDemo/LiveSettingTableViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // LiveSettingTableViewController.m 3 | // HDLive 4 | // 5 | // Created by doulai on 2/19/16. 6 | // Copyright © 2016 doulai. All rights reserved. 7 | // 8 | 9 | #import "LiveSettingTableViewController.h" 10 | #import "LivePredefine.h" 11 | 12 | #import "CastViewController.h" 13 | #import "HardLiveStreamingSdk.h" 14 | 15 | 16 | @interface LiveSettingTableViewController () 17 | { 18 | NSArray *dataSource; 19 | 20 | UIDocumentInteractionController *documentController ; 21 | UITextField *urltextfield; 22 | 23 | HardLiveStreamingSdk *livesdk; 24 | } 25 | @end 26 | 27 | @implementation LiveSettingTableViewController 28 | 29 | - (void)viewDidLoad { 30 | [super viewDidLoad]; 31 | 32 | // Uncomment the following line to preserve selection between presentations. 33 | // self.clearsSelectionOnViewWillAppear = NO; 34 | 35 | // Uncomment the following line to display an Edit button in the navigation bar for this view controller. 36 | 37 | dataSource =@[(@"服务器地址") ,@"直播视频质量",@"带宽设置",@"技术合作",@"QQ咨询"]; 38 | UIView *tmpView = [[UIView alloc] init]; 39 | [self.view setBackgroundColor: BACKGROUNDCORLOR]; 40 | self.tableView.tableFooterView = tmpView; 41 | self.title =@"RTMP推流"; 42 | if(!urltextfield) 43 | { 44 | urltextfield =[[UITextField alloc] initWithFrame:CGRectMake(8, 2, self.view.frame.size.width-10, 40)]; 45 | urltextfield.borderStyle =UITextBorderStyleRoundedRect; 46 | urltextfield.placeholder =@"服务器地址"; 47 | urltextfield.clearButtonMode =UITextBorderStyleLine; 48 | [urltextfield setFont:[UIFont systemFontOfSize:14]]; 49 | urltextfield.returnKeyType = UIReturnKeyDone; 50 | [urltextfield addTarget:self action:@selector(HideKeyboard) forControlEvents:UIControlEventEditingDidEndOnExit]; 51 | NSString *url =[[NSUserDefaults standardUserDefaults] objectForKey:@"defaultserver"]; 52 | 53 | urltextfield.text =url; 54 | } 55 | 56 | 57 | } 58 | -(void)HideKeyboard{ 59 | [self.view endEditing:YES]; 60 | } 61 | - (void)didReceiveMemoryWarning { 62 | [super didReceiveMemoryWarning]; 63 | // Dispose of any resources that can be recreated. 64 | } 65 | -(UIView*)headerview 66 | { 67 | UIView *view =[[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 100)]; 68 | UIImageView *imagview =[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 70, 68)]; 69 | [imagview setImage:[UIImage imageNamed:@"logo"]]; 70 | imagview.center =view.center; 71 | [view addSubview:imagview]; 72 | [view setBackgroundColor: BACKGROUNDCORLOR]; 73 | return view; 74 | } 75 | -(void)footview{ 76 | UIButton *lices =[[UIButton alloc] initWithFrame:CGRectMake(0, 0, 200, 44)]; 77 | [lices setTitle:@"软件使用许可及服务协议" forState:UIControlStateNormal]; 78 | [lices setTitleColor:[UIColor grayColor] forState:UIControlStateNormal]; 79 | 80 | CGPoint center =self.view.center; 81 | CGRect frame =self.view.frame; 82 | 83 | center.y =self.view.frame.size.height -116; 84 | lices.center =center; 85 | 86 | [self.view addSubview:lices]; 87 | 88 | UILabel *about = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 21)]; 89 | about.textAlignment = NSTextAlignmentCenter; 90 | about.text =@"掌上科技版权所有"; 91 | about.textColor =[UIColor grayColor]; 92 | center.y = self.view.frame.size.height -85; 93 | about.center =center; 94 | [self.view addSubview:about]; 95 | } 96 | #pragma mark - Table view data source 97 | 98 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 99 | //#warning Incomplete implementation, return the number of sections 100 | return 4; 101 | } 102 | 103 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 104 | //#warning Incomplete implementation, return the number of rows 105 | if (section ==0) { 106 | return dataSource.count; 107 | } 108 | return 1; 109 | } 110 | 111 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 112 | { 113 | return 50; 114 | } 115 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section; 116 | { 117 | // if (section ==1) { 118 | return 20.; 119 | // } 120 | // return 0; 121 | } 122 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 123 | if (indexPath.section ==0) 124 | { 125 | 126 | 127 | 128 | 129 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"x" ]; 130 | if (!cell) { 131 | cell =[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"x"]; 132 | } 133 | 134 | cell.textLabel.text =dataSource[indexPath.row]; 135 | 136 | if (indexPath.row ==0) { 137 | 138 | cell.textLabel.text =nil; 139 | 140 | [cell addSubview:urltextfield]; 141 | 142 | 143 | }else if(indexPath.row==1){ 144 | NSNumber *videoQulity =[[NSUserDefaults standardUserDefaults] objectForKey:kVIDEOQUALITY]; 145 | NSArray *tmp = VIDEO_QUALITY_LIST[[videoQulity integerValue]]; 146 | cell.detailTextLabel.text =tmp[0]; 147 | cell.detailTextLabel.textColor =[UIColor blueColor]; 148 | cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 149 | }else if(indexPath.row ==2) 150 | { 151 | 152 | NSNumber *videoQulity =[[NSUserDefaults standardUserDefaults] objectForKey:kVIDEOBitratecontrol]; 153 | NSString *tmp = VIDEO_BITRATE_CONTROL[[videoQulity integerValue]]; 154 | cell.detailTextLabel.text =tmp; 155 | cell.detailTextLabel.textColor =[UIColor blueColor]; 156 | cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 157 | } 158 | else if(indexPath.row== 3) 159 | { 160 | cell.detailTextLabel.text=@"+8615988879319"; 161 | cell.detailTextLabel.textColor =[UIColor blueColor]; 162 | cell.accessoryType =UITableViewCellAccessoryDisclosureIndicator; 163 | 164 | } 165 | else if(indexPath.row== 4) 166 | { 167 | cell.detailTextLabel.text=@"153887715"; 168 | cell.detailTextLabel.textColor =[UIColor blueColor]; 169 | cell.accessoryType =UITableViewCellAccessoryDisclosureIndicator; 170 | 171 | } 172 | return cell; 173 | }else{ 174 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"y" ]; 175 | if (!cell) { 176 | cell =[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"y"]; 177 | } 178 | if (indexPath.section ==1) { 179 | cell.textLabel.text =@"开始推流"; 180 | cell.textLabel.textColor =[UIColor redColor]; 181 | }else if(indexPath.section ==2) 182 | { 183 | cell.textLabel.text =@"开始播放"; 184 | cell.textLabel.textColor =[UIColor blueColor]; 185 | }else if(indexPath.section ==3) 186 | { 187 | cell.textLabel.text =@"播放录制视频"; 188 | cell.textLabel.textColor =[UIColor blueColor]; 189 | } 190 | 191 | 192 | cell.textLabel.textAlignment =NSTextAlignmentCenter; 193 | return cell; 194 | 195 | } 196 | // Configure the cell... 197 | 198 | } 199 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;{ 200 | [tableView deselectRowAtIndexPath:indexPath animated:NO]; 201 | if (indexPath.section ==0) { 202 | if (indexPath.row ==1) { 203 | UIActionSheet *sheet =[[UIActionSheet alloc] initWithTitle:@"选择视频质量" delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:nil, nil]; 204 | for (NSArray *item in VIDEO_QUALITY_LIST) { 205 | [sheet addButtonWithTitle:item[0]]; 206 | } 207 | sheet.tag=1; 208 | [sheet showInView:self.view]; 209 | }else if(indexPath.row ==2) 210 | { 211 | UIActionSheet *sheet =[[UIActionSheet alloc] initWithTitle:@"带宽设置" delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:nil, nil]; 212 | for (NSString *item in VIDEO_BITRATE_CONTROL) { 213 | [sheet addButtonWithTitle:item]; 214 | } 215 | sheet.tag =2; 216 | [sheet showInView:self.view]; 217 | } 218 | else if (indexPath.row==3){ 219 | UITableViewCell*cell =[tableView cellForRowAtIndexPath:indexPath]; 220 | NSString *phone =cell.detailTextLabel.text; 221 | // 222 | NSMutableString * str=[[NSMutableString alloc] initWithFormat:@"telprompt://%@",phone]; 223 | // NSLog(@"str======%@",str); 224 | [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]]; 225 | 226 | } 227 | else if (indexPath.row==4){ 228 | UITableViewCell*cell =[tableView cellForRowAtIndexPath:indexPath]; 229 | NSString *phone =cell.detailTextLabel.text; 230 | [self pressQQ:nil]; 231 | 232 | } 233 | }else { 234 | 235 | 236 | NSString*serverurl =urltextfield.text; 237 | if(serverurl) 238 | [[NSUserDefaults standardUserDefaults] setObject:serverurl forKey:@"defaultserver"]; 239 | 240 | if (indexPath.section ==1) { 241 | [self pressLive]; 242 | 243 | }else if(indexPath.section ==2){ 244 | 245 | [self playMovie:serverurl]; 246 | }else if(indexPath.section ==3){ 247 | // 248 | // [self playMovie:serverurl]; 249 | [self playRecords]; 250 | } 251 | 252 | } 253 | 254 | } 255 | -(void)playRecords{ 256 | NSArray*tmp= [[NSUserDefaults standardUserDefaults] objectForKey:@"filelist"]; 257 | if (tmp.count ==0) { 258 | return; 259 | } 260 | UIActionSheet*sheet =[[UIActionSheet alloc] initWithTitle:@"choose" delegate:self cancelButtonTitle:@"cancel" destructiveButtonTitle:nil otherButtonTitles:nil]; 261 | sheet.tag =10; 262 | for (NSString *item in tmp) { 263 | [sheet addButtonWithTitle:item]; 264 | } 265 | [sheet showInView:self.view]; 266 | } 267 | 268 | -(void)playRecord:(NSString*)file{ 269 | NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; 270 | 271 | 272 | NSString *path =[self dataFilePath:file]; 273 | 274 | [self sendToQQ:path]; 275 | return; 276 | 277 | 278 | 279 | } 280 | -(void)playMovie:(NSString*)path{ 281 | 282 | //播放器接口,可以播放各种格式 283 | if(!livesdk) 284 | livesdk =[[HardLiveStreamingSdk alloc] init]; 285 | 286 | [livesdk lib_doulai_single_play_start:self.navigationController playAdress:path]; 287 | 288 | 289 | } 290 | - (IBAction)pressQQ:(id)sender { 291 | UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectZero]; 292 | NSURL *url = [NSURL URLWithString:@"mqq://im/chat?chat_type=wpa&uin=153887715&version=1&src_type=web&msg=live"]; 293 | NSURLRequest *request = [NSURLRequest requestWithURL:url]; 294 | webView.delegate = self; 295 | [webView loadRequest:request]; 296 | [self.view addSubview:webView]; 297 | } 298 | -(void)sendToQQ:(NSString*)filepath{ 299 | 300 | 301 | if (![[NSFileManager defaultManager] fileExistsAtPath:filepath]) 302 | return; 303 | 304 | NSString *cachePath =filepath; 305 | 306 | 307 | documentController = 308 | 309 | 310 | [UIDocumentInteractionController 311 | 312 | interactionControllerWithURL:[NSURL fileURLWithPath:cachePath]]; 313 | 314 | documentController.delegate = self; 315 | 316 | 317 | [documentController presentOpenInMenuFromRect:CGRectZero 318 | 319 | inView:self.view 320 | 321 | animated:YES]; 322 | 323 | } 324 | - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { 325 | 326 | if ( buttonIndex >0) { 327 | if (actionSheet.tag ==1) { 328 | NSNumber *video =[NSNumber numberWithInteger:buttonIndex-1] ; 329 | [[NSUserDefaults standardUserDefaults] setObject:video forKey:kVIDEOQUALITY]; 330 | NSNumber *fps =@15; 331 | if (buttonIndex ==1) { 332 | fps =@25; 333 | } 334 | [[NSUserDefaults standardUserDefaults] setObject:fps forKey:@"kVIDEO_FPS"]; 335 | 336 | }else if(actionSheet.tag==10) 337 | { 338 | NSArray*tmp= [[NSUserDefaults standardUserDefaults] objectForKey:@"filelist"]; 339 | if (buttonIndex>0 &&buttonIndex <=tmp.count) { 340 | 341 | [self playRecord:tmp[buttonIndex-1]]; 342 | 343 | } 344 | }else 345 | { 346 | NSNumber *video =[NSNumber numberWithInteger:buttonIndex-1] ; 347 | [[NSUserDefaults standardUserDefaults] setObject:video forKey:kVIDEOBitratecontrol]; 348 | } 349 | 350 | [self.tableView reloadData]; 351 | 352 | } 353 | } 354 | -(void)pressLive{ 355 | CastViewController *detail =[CastViewController new]; 356 | 357 | detail.uploadUrl = [urltextfield.text lowercaseString]; 358 | if (![detail.uploadUrl hasPrefix:@"rtmp://"]) { 359 | UIAlertView *alert =[[UIAlertView alloc] initWithTitle:nil message:@"请输入完整RTMP流服务器地址" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil]; 360 | [alert show]; 361 | return; 362 | } 363 | [self presentViewController:detail animated:YES completion:nil]; 364 | } 365 | 366 | -(NSString *)dataFilePath:(NSString*)file{ 367 | NSArray *paths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask, YES); 368 | 369 | NSString *documentsDirectory = [paths objectAtIndex:0]; 370 | 371 | return [documentsDirectory stringByAppendingPathComponent:file]; 372 | 373 | } 374 | 375 | @end 376 | -------------------------------------------------------------------------------- /HDLiveStreamingDemo/HDLiveStreamingDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // HDLiveStreamingDemo 4 | // 5 | // Created by doulai on 6/8/16. 6 | // Copyright © 2016 doulai. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /HDLiveStreamingDemo/HDLiveStreamingDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // HDLiveStreamingDemo 4 | // 5 | // Created by doulai on 6/8/16. 6 | // Copyright © 2016 doulai. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | 13 | @end 14 | 15 | @implementation ViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view, typically from a nib. 20 | } 21 | 22 | - (void)didReceiveMemoryWarning { 23 | [super didReceiveMemoryWarning]; 24 | // Dispose of any resources that can be recreated. 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /HDLiveStreamingDemo/HDLiveStreamingDemo/include/HardLiveStreamingSdk/HardLiveStreamingSdk.h: -------------------------------------------------------------------------------- 1 | // 2 | // HardLiveStreamingSdk.h 3 | // HardLiveStreamingSdk 4 | // 5 | // Created by doulai on 6/8/16. 6 | // Copyright © 2016 doulai. All rights reserved. 7 | // 8 | 9 | //readme 10 | //调用者必须是.mm文件 11 | 12 | // 13 | #import 14 | #import 15 | #import 16 | #import 17 | #define ERROR_NETWORK -10 18 | #define ERROR_CAMERA -11 19 | #define ERROR_AUDIO -12 20 | #define ERROR_PERMISSION -13 21 | #define IOS8VT [[[UIDevice currentDevice] systemVersion]floatValue]>=8 22 | 23 | @protocol ReportDelegate 24 | 25 | @optional 26 | 27 | -(void)reportFps:(int)fps bitrate:(int)bitrate width:(int)w height:(int)h ; 28 | @end 29 | 30 | 31 | @interface HardLiveStreamingSdk : NSObject 32 | @property (assign) id delegate; 33 | @property int encoderType; //0 software ,1 HaredWare1,2 HaredWareFile 34 | 35 | 36 | //播放接口,支持各种视频格式 37 | - (void)lib_doulai_single_play_start:(UINavigationController *) nav playAdress:(NSString *)path; 38 | 39 | 40 | 41 | - (int) lib_doulai_record_support; 42 | //视频预览 43 | - (void) lib_doulai_record_start_preview:(UIView *)parentView videoWidth:(int)w height:(int)h bitrate:(int)br; 44 | 45 | - (void) lib_doulai_record_stop_preview; 46 | //开始推流 47 | - (void) lib_doulai_record_start_upload:(const char*)url; 48 | - (void) lib_doulai_record_stop_upload; 49 | //视频控制接口 50 | - (void) lib_doulai_video_switchCapture; 51 | - (int) lib_doulai_video_hasFlashMode; 52 | - (void) lib_doulai_video_setFlashMode:(int)flashmode; 53 | - (void) lib_doulai_audio_switchMute; 54 | -(void)lib_doulai_video_switchFocus:(CGPoint)forcusP; 55 | 56 | 57 | @property (readwrite) BOOL playing; 58 | @property (readwrite) BOOL previewing; 59 | @property (readwrite) BOOL uploading; 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /HDLiveStreamingDemo/HDLiveStreamingDemo/libHardLiveStreamingSdk.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newOcean/HDLiveStreamingSdk/1653c720c6e02953234c295fa13fbaf6752f2ca9/HDLiveStreamingDemo/HDLiveStreamingDemo/libHardLiveStreamingSdk.a -------------------------------------------------------------------------------- /HDLiveStreamingDemo/HDLiveStreamingDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // HDLiveStreamingDemo 4 | // 5 | // Created by doulai on 6/8/16. 6 | // Copyright © 2016 doulai. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /HDLiveStreamingDemo/HDLiveStreamingDemo/xfb/Reachability.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | File: Reachability.h 4 | Abstract: Basic demonstration of how to use the SystemConfiguration Reachablity APIs. 5 | 6 | Version: 2.2 7 | 8 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc. 9 | ("Apple") in consideration of your agreement to the following terms, and your 10 | use, installation, modification or redistribution of this Apple software 11 | constitutes acceptance of these terms. If you do not agree with these terms, 12 | please do not use, install, modify or redistribute this Apple software. 13 | 14 | In consideration of your agreement to abide by the following terms, and subject 15 | to these terms, Apple grants you a personal, non-exclusive license, under 16 | Apple's copyrights in this original Apple software (the "Apple Software"), to 17 | use, reproduce, modify and redistribute the Apple Software, with or without 18 | modifications, in source and/or binary forms; provided that if you redistribute 19 | the Apple Software in its entirety and without modifications, you must retain 20 | this notice and the following text and disclaimers in all such redistributions 21 | of the Apple Software. 22 | Neither the name, trademarks, service marks or logos of Apple Inc. may be used 23 | to endorse or promote products derived from the Apple Software without specific 24 | prior written permission from Apple. Except as expressly stated in this notice, 25 | no other rights or licenses, express or implied, are granted by Apple herein, 26 | including but not limited to any patent rights that may be infringed by your 27 | derivative works or by other works in which the Apple Software may be 28 | incorporated. 29 | 30 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO 31 | WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED 32 | WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR 33 | PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN 34 | COMBINATION WITH YOUR PRODUCTS. 35 | 36 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR 37 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 38 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 39 | ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR 40 | DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF 41 | CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF 42 | APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 43 | 44 | Copyright (C) 2010 Apple Inc. All Rights Reserved. 45 | 46 | */ 47 | 48 | 49 | #import 50 | #import 51 | 52 | typedef enum { 53 | NotReachable = 0, 54 | ReachableViaWiFi, 55 | ReachableViaWWAN 56 | } NetworkStatus; 57 | #define kReachabilityChangedNotification @"kNetworkReachabilityChangedNotification" 58 | 59 | @interface Reachability: NSObject 60 | { 61 | BOOL localWiFiRef; 62 | SCNetworkReachabilityRef reachabilityRef; 63 | } 64 | 65 | //reachabilityWithHostName- Use to check the reachability of a particular host name. 66 | + (Reachability*) reachabilityWithHostName: (NSString*) hostName; 67 | 68 | //reachabilityWithAddress- Use to check the reachability of a particular IP address. 69 | + (Reachability*) reachabilityWithAddress: (const struct sockaddr_in*) hostAddress; 70 | 71 | //reachabilityForInternetConnection- checks whether the default route is available. 72 | // Should be used by applications that do not connect to a particular host 73 | + (Reachability*) reachabilityForInternetConnection; 74 | 75 | //reachabilityForLocalWiFi- checks whether a local wifi connection is available. 76 | + (Reachability*) reachabilityForLocalWiFi; 77 | +(NSString*)GetNetWorkType; 78 | //Start listening for reachability notifications on the current run loop 79 | - (BOOL) startNotifier; 80 | - (void) stopNotifier; 81 | 82 | - (NetworkStatus) currentReachabilityStatus; 83 | //WWAN may be available, but not active until a connection has been established. 84 | //WiFi may require a connection for VPN on Demand. 85 | - (BOOL) connectionRequired; 86 | @end 87 | 88 | 89 | -------------------------------------------------------------------------------- /HDLiveStreamingDemo/HDLiveStreamingDemo/xfb/Reachability.m: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | File: Reachability.m 4 | Abstract: Basic demonstration of how to use the SystemConfiguration Reachablity APIs. 5 | 6 | Version: 2.2 7 | 8 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc. 9 | ("Apple") in consideration of your agreement to the following terms, and your 10 | use, installation, modification or redistribution of this Apple software 11 | constitutes acceptance of these terms. If you do not agree with these terms, 12 | please do not use, install, modify or redistribute this Apple software. 13 | 14 | In consideration of your agreement to abide by the following terms, and subject 15 | to these terms, Apple grants you a personal, non-exclusive license, under 16 | Apple's copyrights in this original Apple software (the "Apple Software"), to 17 | use, reproduce, modify and redistribute the Apple Software, with or without 18 | modifications, in source and/or binary forms; provided that if you redistribute 19 | the Apple Software in its entirety and without modifications, you must retain 20 | this notice and the following text and disclaimers in all such redistributions 21 | of the Apple Software. 22 | Neither the name, trademarks, service marks or logos of Apple Inc. may be used 23 | to endorse or promote products derived from the Apple Software without specific 24 | prior written permission from Apple. Except as expressly stated in this notice, 25 | no other rights or licenses, express or implied, are granted by Apple herein, 26 | including but not limited to any patent rights that may be infringed by your 27 | derivative works or by other works in which the Apple Software may be 28 | incorporated. 29 | 30 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO 31 | WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED 32 | WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR 33 | PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN 34 | COMBINATION WITH YOUR PRODUCTS. 35 | 36 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR 37 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 38 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 39 | ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR 40 | DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF 41 | CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF 42 | APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 43 | 44 | Copyright (C) 2010 Apple Inc. All Rights Reserved. 45 | 46 | */ 47 | 48 | #import 49 | #import 50 | #import 51 | #import 52 | #import 53 | #import 54 | #import 55 | #import 56 | 57 | #import "Reachability.h" 58 | #import 59 | 60 | 61 | //xxtxx 62 | #define kShouldPrintReachabilityFlags 1 63 | 64 | static void PrintReachabilityFlags(SCNetworkReachabilityFlags flags, const char* comment) 65 | { 66 | #if kShouldPrintReachabilityFlags 67 | 68 | NSLog(@"Reachability Flag Status: %c%c %c%c%c%c%c%c%c %s\n", 69 | (flags & kSCNetworkReachabilityFlagsIsWWAN) ? 'W' : '-', 70 | (flags & kSCNetworkReachabilityFlagsReachable) ? 'R' : '-', 71 | 72 | (flags & kSCNetworkReachabilityFlagsTransientConnection) ? 't' : '-', 73 | (flags & kSCNetworkReachabilityFlagsConnectionRequired) ? 'c' : '-', 74 | (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) ? 'C' : '-', 75 | (flags & kSCNetworkReachabilityFlagsInterventionRequired) ? 'i' : '-', 76 | (flags & kSCNetworkReachabilityFlagsConnectionOnDemand) ? 'D' : '-', 77 | (flags & kSCNetworkReachabilityFlagsIsLocalAddress) ? 'l' : '-', 78 | (flags & kSCNetworkReachabilityFlagsIsDirect) ? 'd' : '-', 79 | comment 80 | ); 81 | #endif 82 | } 83 | 84 | 85 | @implementation Reachability 86 | static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void* info) 87 | { 88 | #pragma unused (target, flags) 89 | NSCAssert(info != NULL, @"info was NULL in ReachabilityCallback"); 90 | NSCAssert([(NSObject*) info isKindOfClass: [Reachability class]], @"info was wrong class in ReachabilityCallback"); 91 | 92 | //We're on the main RunLoop, so an NSAutoreleasePool is not necessary, but is added defensively 93 | // in case someon uses the Reachablity object in a different thread. 94 | NSAutoreleasePool* myPool = [[NSAutoreleasePool alloc] init]; 95 | 96 | Reachability* noteObject = (Reachability*) info; 97 | // Post a notification to notify the client that the network reachability changed. 98 | [[NSNotificationCenter defaultCenter] postNotificationName: kReachabilityChangedNotification object: noteObject]; 99 | 100 | [myPool release]; 101 | } 102 | 103 | - (BOOL) startNotifier 104 | { 105 | BOOL retVal = NO; 106 | SCNetworkReachabilityContext context = {0, self, NULL, NULL, NULL}; 107 | if(SCNetworkReachabilitySetCallback(reachabilityRef, ReachabilityCallback, &context)) 108 | { 109 | if(SCNetworkReachabilityScheduleWithRunLoop(reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode)) 110 | { 111 | retVal = YES; 112 | } 113 | } 114 | return retVal; 115 | } 116 | 117 | - (void) stopNotifier 118 | { 119 | if(reachabilityRef!= NULL) 120 | { 121 | SCNetworkReachabilityUnscheduleFromRunLoop(reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); 122 | } 123 | } 124 | 125 | - (void) dealloc 126 | { 127 | [self stopNotifier]; 128 | if(reachabilityRef!= NULL) 129 | { 130 | CFRelease(reachabilityRef); 131 | } 132 | [super dealloc]; 133 | } 134 | 135 | + (Reachability*) reachabilityWithHostName: (NSString*) hostName; 136 | { 137 | Reachability* retVal = NULL; 138 | SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, [hostName UTF8String]); 139 | if(reachability!= NULL) 140 | { 141 | retVal= [[[self alloc] init] autorelease]; 142 | if(retVal!= NULL) 143 | { 144 | retVal->reachabilityRef = reachability; 145 | retVal->localWiFiRef = NO; 146 | } 147 | } 148 | return retVal; 149 | } 150 | 151 | + (Reachability*) reachabilityWithAddress: (const struct sockaddr_in*) hostAddress; 152 | { 153 | SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr*)hostAddress); 154 | Reachability* retVal = NULL; 155 | if(reachability!= NULL) 156 | { 157 | retVal= [[[self alloc] init] autorelease]; 158 | if(retVal!= NULL) 159 | { 160 | retVal->reachabilityRef = reachability; 161 | retVal->localWiFiRef = NO; 162 | } 163 | } 164 | return retVal; 165 | } 166 | 167 | + (Reachability*) reachabilityForInternetConnection; 168 | { 169 | struct sockaddr_in zeroAddress; 170 | bzero(&zeroAddress, sizeof(zeroAddress)); 171 | zeroAddress.sin_len = sizeof(zeroAddress); 172 | zeroAddress.sin_family = AF_INET; 173 | return [self reachabilityWithAddress: &zeroAddress]; 174 | } 175 | 176 | + (Reachability*) reachabilityForLocalWiFi; 177 | { 178 | struct sockaddr_in localWifiAddress; 179 | bzero(&localWifiAddress, sizeof(localWifiAddress)); 180 | localWifiAddress.sin_len = sizeof(localWifiAddress); 181 | localWifiAddress.sin_family = AF_INET; 182 | // IN_LINKLOCALNETNUM is defined in as 169.254.0.0 183 | localWifiAddress.sin_addr.s_addr = htonl(IN_LINKLOCALNETNUM); 184 | Reachability* retVal = [self reachabilityWithAddress: &localWifiAddress]; 185 | if(retVal!= NULL) 186 | { 187 | retVal->localWiFiRef = YES; 188 | } 189 | return retVal; 190 | } 191 | 192 | #pragma mark Network Flag Handling 193 | 194 | - (NetworkStatus) localWiFiStatusForFlags: (SCNetworkReachabilityFlags) flags 195 | { 196 | PrintReachabilityFlags(flags, "localWiFiStatusForFlags"); 197 | 198 | BOOL retVal = NotReachable; 199 | if((flags & kSCNetworkReachabilityFlagsReachable) && (flags & kSCNetworkReachabilityFlagsIsDirect)) 200 | { 201 | retVal = ReachableViaWiFi; 202 | } 203 | return retVal; 204 | } 205 | 206 | - (NetworkStatus) networkStatusForFlags: (SCNetworkReachabilityFlags) flags 207 | { 208 | PrintReachabilityFlags(flags, "networkStatusForFlags"); 209 | if ((flags & kSCNetworkReachabilityFlagsReachable) == 0) 210 | { 211 | // if target host is not reachable 212 | return NotReachable; 213 | } 214 | 215 | BOOL retVal = NotReachable; 216 | 217 | if ((flags & kSCNetworkReachabilityFlagsConnectionRequired) == 0) 218 | { 219 | // if target host is reachable and no connection is required 220 | // then we'll assume (for now) that your on Wi-Fi 221 | retVal = ReachableViaWiFi; 222 | } 223 | 224 | 225 | if ((((flags & kSCNetworkReachabilityFlagsConnectionOnDemand ) != 0) || 226 | (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0)) 227 | { 228 | // ... and the connection is on-demand (or on-traffic) if the 229 | // calling application is using the CFSocketStream or higher APIs 230 | 231 | if ((flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0) 232 | { 233 | // ... and no [user] intervention is needed 234 | retVal = ReachableViaWiFi; 235 | } 236 | } 237 | 238 | if ((flags & kSCNetworkReachabilityFlagsIsWWAN) == kSCNetworkReachabilityFlagsIsWWAN) 239 | { 240 | // ... but WWAN connections are OK if the calling application 241 | // is using the CFNetwork (CFSocketStream?) APIs. 242 | retVal = ReachableViaWWAN; 243 | } 244 | return retVal; 245 | } 246 | 247 | - (BOOL) connectionRequired; 248 | { 249 | NSAssert(reachabilityRef != NULL, @"connectionRequired called with NULL reachabilityRef"); 250 | SCNetworkReachabilityFlags flags; 251 | if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags)) 252 | { 253 | return (flags & kSCNetworkReachabilityFlagsConnectionRequired); 254 | } 255 | return NO; 256 | } 257 | 258 | - (NetworkStatus) currentReachabilityStatus 259 | { 260 | NSAssert(reachabilityRef != NULL, @"currentNetworkStatus called with NULL reachabilityRef"); 261 | NetworkStatus retVal = NotReachable; 262 | SCNetworkReachabilityFlags flags; 263 | if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags)) 264 | { 265 | if(localWiFiRef) 266 | { 267 | retVal = [self localWiFiStatusForFlags: flags]; 268 | } 269 | else 270 | { 271 | retVal = [self networkStatusForFlags: flags]; 272 | } 273 | } 274 | return retVal; 275 | } 276 | +(NSString*)GetNetWorkType 277 | { 278 | NSString* strNetworkType = @""; 279 | 280 | //创建零地址,0.0.0.0的地址表示查询本机的网络连接状态 281 | struct sockaddr_storage zeroAddress; 282 | 283 | bzero(&zeroAddress, sizeof(zeroAddress)); 284 | zeroAddress.ss_len = sizeof(zeroAddress); 285 | zeroAddress.ss_family = AF_INET; 286 | 287 | // Recover reachability flags 288 | SCNetworkReachabilityRef defaultRouteReachability = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)&zeroAddress); 289 | SCNetworkReachabilityFlags flags; 290 | 291 | //获得连接的标志 292 | BOOL didRetrieveFlags = SCNetworkReachabilityGetFlags(defaultRouteReachability, &flags); 293 | CFRelease(defaultRouteReachability); 294 | 295 | //如果不能获取连接标志,则不能连接网络,直接返回 296 | if (!didRetrieveFlags) 297 | { 298 | return strNetworkType; 299 | } 300 | 301 | 302 | if ((flags & kSCNetworkReachabilityFlagsConnectionRequired) == 0) 303 | { 304 | // if target host is reachable and no connection is required 305 | // then we'll assume (for now) that your on Wi-Fi 306 | strNetworkType = @"WIFI"; 307 | } 308 | 309 | if ( 310 | ((flags & kSCNetworkReachabilityFlagsConnectionOnDemand ) != 0) || 311 | (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0 312 | ) 313 | { 314 | // ... and the connection is on-demand (or on-traffic) if the 315 | // calling application is using the CFSocketStream or higher APIs 316 | if ((flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0) 317 | { 318 | // ... and no [user] intervention is needed 319 | strNetworkType = @"WIFI"; 320 | } 321 | } 322 | 323 | if ((flags & kSCNetworkReachabilityFlagsIsWWAN) == kSCNetworkReachabilityFlagsIsWWAN) 324 | { 325 | if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) 326 | { 327 | CTTelephonyNetworkInfo * info = [[CTTelephonyNetworkInfo alloc] init]; 328 | NSString *currentRadioAccessTechnology = info.currentRadioAccessTechnology; 329 | 330 | if (currentRadioAccessTechnology) 331 | { 332 | if ([currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyLTE]) 333 | { 334 | strNetworkType = @"4G"; 335 | } 336 | else if ([currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyEdge] || [currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyGPRS]) 337 | { 338 | strNetworkType = @"2G"; 339 | } 340 | else 341 | { 342 | strNetworkType = @"3G"; 343 | } 344 | } 345 | } 346 | else 347 | { 348 | if((flags & kSCNetworkReachabilityFlagsReachable) == kSCNetworkReachabilityFlagsReachable) 349 | { 350 | if ((flags & kSCNetworkReachabilityFlagsTransientConnection) == kSCNetworkReachabilityFlagsTransientConnection) 351 | { 352 | if((flags & kSCNetworkReachabilityFlagsConnectionRequired) == kSCNetworkReachabilityFlagsConnectionRequired) 353 | { 354 | strNetworkType = @"2G"; 355 | } 356 | else 357 | { 358 | strNetworkType = @"3G"; 359 | } 360 | } 361 | } 362 | } 363 | } 364 | 365 | 366 | if ([strNetworkType isEqualToString: @""]) { 367 | strNetworkType = @"WWAN"; 368 | } 369 | 370 | // NSLog( @"GetNetWorkType() strNetworkType : %s", strNetworkType.c_str()); 371 | 372 | return strNetworkType; 373 | } 374 | 375 | @end 376 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HDLiveStreamingSdk 2 | ios RTMP live hardware encoder and decoder 3 | iOS 的音视频推流,以及播放sdk。 4 | 5 | 1.实现了软编码推流和硬编码RTMP推流,软编码的兼容性比较好,硬编码的性能非常好1080p 30fps。 6 | 2.实现了软解码的视频文件,网络视频等的播放,还可以录制视频,拍照。 7 | 3.可以显示硬解码的视频播放,但需要商业合作。 8 | 9 | 当前YY 斗鱼 在直播 等直播秀非常火爆,需要使用此sdk的请联系qq153887715. 10 | 此demo仅用于演示功能以及性能,sdk已经做了时间限制,在2016年10月1号前有效。 11 | 12 | 13 | --------------------------------------------------------------------------------