Commit be2ab2b8100b84b913b83ef2055eb914b6824bf9
1 parent
69c75123
直播页
Showing
44 changed files
with
1461 additions
and
165 deletions
LiveVideoCloud/LiveVideoCloud.xcodeproj/project.pbxproj
| @@ -19,14 +19,16 @@ | @@ -19,14 +19,16 @@ | ||
| 19 | 810B65051E779B1F00133E15 /* NSLayoutConstraint+MASDebugAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 810B64F81E779B1F00133E15 /* NSLayoutConstraint+MASDebugAdditions.m */; }; | 19 | 810B65051E779B1F00133E15 /* NSLayoutConstraint+MASDebugAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 810B64F81E779B1F00133E15 /* NSLayoutConstraint+MASDebugAdditions.m */; }; |
| 20 | 810B65061E779B1F00133E15 /* View+MASAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 810B64FA1E779B1F00133E15 /* View+MASAdditions.m */; }; | 20 | 810B65061E779B1F00133E15 /* View+MASAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 810B64FA1E779B1F00133E15 /* View+MASAdditions.m */; }; |
| 21 | 810B65071E779B1F00133E15 /* ViewController+MASAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 810B64FD1E779B1F00133E15 /* ViewController+MASAdditions.m */; }; | 21 | 810B65071E779B1F00133E15 /* ViewController+MASAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 810B64FD1E779B1F00133E15 /* ViewController+MASAdditions.m */; }; |
| 22 | + 810B650A1E77B39D00133E15 /* LVCFullScreenPlayerController.m in Sources */ = {isa = PBXBuildFile; fileRef = 810B65091E77B39D00133E15 /* LVCFullScreenPlayerController.m */; }; | ||
| 23 | + 8112D4311E7927A5002E00F6 /* LVCPlayerLoadingView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8112D4301E7927A5002E00F6 /* LVCPlayerLoadingView.m */; }; | ||
| 22 | 812E50531E7699DC004F5FCD /* CNLivePlayerSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 812E50501E7699DC004F5FCD /* CNLivePlayerSDK.framework */; }; | 24 | 812E50531E7699DC004F5FCD /* CNLivePlayerSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 812E50501E7699DC004F5FCD /* CNLivePlayerSDK.framework */; }; |
| 23 | 812E50541E7699DC004F5FCD /* KSYGPUResource.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 812E50511E7699DC004F5FCD /* KSYGPUResource.bundle */; }; | 25 | 812E50541E7699DC004F5FCD /* KSYGPUResource.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 812E50511E7699DC004F5FCD /* KSYGPUResource.bundle */; }; |
| 24 | 812E50551E7699E9004F5FCD /* CNLiveMsgTools.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 812E504F1E7699DC004F5FCD /* CNLiveMsgTools.framework */; }; | 26 | 812E50551E7699E9004F5FCD /* CNLiveMsgTools.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 812E504F1E7699DC004F5FCD /* CNLiveMsgTools.framework */; }; |
| 25 | 812E50561E7699E9004F5FCD /* CNLiveMsgTools.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 812E504F1E7699DC004F5FCD /* CNLiveMsgTools.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; | 27 | 812E50561E7699E9004F5FCD /* CNLiveMsgTools.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 812E504F1E7699DC004F5FCD /* CNLiveMsgTools.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; |
| 26 | 812E50581E7699E9004F5FCD /* CNLivePlayerSDK.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 812E50501E7699DC004F5FCD /* CNLivePlayerSDK.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; | 28 | 812E50581E7699E9004F5FCD /* CNLivePlayerSDK.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 812E50501E7699DC004F5FCD /* CNLivePlayerSDK.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; |
| 29 | + 81FB5B031E7A251300F98E1D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 81FB5B021E7A251300F98E1D /* Assets.xcassets */; }; | ||
| 30 | + 81FB5B3C1E7A6FFC00F98E1D /* SevenSwitch.m in Sources */ = {isa = PBXBuildFile; fileRef = 81FB5B3B1E7A6FFC00F98E1D /* SevenSwitch.m */; }; | ||
| 27 | D2029B861E6EAAA50027CD92 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D2029B851E6EAAA50027CD92 /* main.m */; }; | 31 | D2029B861E6EAAA50027CD92 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D2029B851E6EAAA50027CD92 /* main.m */; }; |
| 28 | - D2029B8F1E6EAAA50027CD92 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D2029B8D1E6EAAA50027CD92 /* Main.storyboard */; }; | ||
| 29 | - D2029B911E6EAAA50027CD92 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D2029B901E6EAAA50027CD92 /* Assets.xcassets */; }; | ||
| 30 | D2029B941E6EAAA50027CD92 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D2029B921E6EAAA50027CD92 /* LaunchScreen.storyboard */; }; | 32 | D2029B941E6EAAA50027CD92 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D2029B921E6EAAA50027CD92 /* LaunchScreen.storyboard */; }; |
| 31 | D2029B9F1E6EAAA50027CD92 /* LiveVideoCloudTests.m in Sources */ = {isa = PBXBuildFile; fileRef = D2029B9E1E6EAAA50027CD92 /* LiveVideoCloudTests.m */; }; | 33 | D2029B9F1E6EAAA50027CD92 /* LiveVideoCloudTests.m in Sources */ = {isa = PBXBuildFile; fileRef = D2029B9E1E6EAAA50027CD92 /* LiveVideoCloudTests.m */; }; |
| 32 | D2029BAA1E6EAAA50027CD92 /* LiveVideoCloudUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = D2029BA91E6EAAA50027CD92 /* LiveVideoCloudUITests.m */; }; | 34 | D2029BAA1E6EAAA50027CD92 /* LiveVideoCloudUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = D2029BA91E6EAAA50027CD92 /* LiveVideoCloudUITests.m */; }; |
| @@ -203,13 +205,18 @@ | @@ -203,13 +205,18 @@ | ||
| 203 | 810B64FB1E779B1F00133E15 /* View+MASShorthandAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "View+MASShorthandAdditions.h"; sourceTree = "<group>"; }; | 205 | 810B64FB1E779B1F00133E15 /* View+MASShorthandAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "View+MASShorthandAdditions.h"; sourceTree = "<group>"; }; |
| 204 | 810B64FC1E779B1F00133E15 /* ViewController+MASAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ViewController+MASAdditions.h"; sourceTree = "<group>"; }; | 206 | 810B64FC1E779B1F00133E15 /* ViewController+MASAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ViewController+MASAdditions.h"; sourceTree = "<group>"; }; |
| 205 | 810B64FD1E779B1F00133E15 /* ViewController+MASAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "ViewController+MASAdditions.m"; sourceTree = "<group>"; }; | 207 | 810B64FD1E779B1F00133E15 /* ViewController+MASAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "ViewController+MASAdditions.m"; sourceTree = "<group>"; }; |
| 208 | + 810B65081E77B39D00133E15 /* LVCFullScreenPlayerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCFullScreenPlayerController.h; sourceTree = "<group>"; }; | ||
| 209 | + 810B65091E77B39D00133E15 /* LVCFullScreenPlayerController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCFullScreenPlayerController.m; sourceTree = "<group>"; }; | ||
| 210 | + 8112D42F1E7927A5002E00F6 /* LVCPlayerLoadingView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCPlayerLoadingView.h; sourceTree = "<group>"; }; | ||
| 211 | + 8112D4301E7927A5002E00F6 /* LVCPlayerLoadingView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCPlayerLoadingView.m; sourceTree = "<group>"; }; | ||
| 206 | 812E504F1E7699DC004F5FCD /* CNLiveMsgTools.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CNLiveMsgTools.framework; sourceTree = "<group>"; }; | 212 | 812E504F1E7699DC004F5FCD /* CNLiveMsgTools.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CNLiveMsgTools.framework; sourceTree = "<group>"; }; |
| 207 | 812E50501E7699DC004F5FCD /* CNLivePlayerSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CNLivePlayerSDK.framework; sourceTree = "<group>"; }; | 213 | 812E50501E7699DC004F5FCD /* CNLivePlayerSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CNLivePlayerSDK.framework; sourceTree = "<group>"; }; |
| 208 | 812E50511E7699DC004F5FCD /* KSYGPUResource.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = KSYGPUResource.bundle; sourceTree = "<group>"; }; | 214 | 812E50511E7699DC004F5FCD /* KSYGPUResource.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = KSYGPUResource.bundle; sourceTree = "<group>"; }; |
| 215 | + 81FB5B021E7A251300F98E1D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; | ||
| 216 | + 81FB5B3A1E7A6FFC00F98E1D /* SevenSwitch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SevenSwitch.h; sourceTree = "<group>"; }; | ||
| 217 | + 81FB5B3B1E7A6FFC00F98E1D /* SevenSwitch.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SevenSwitch.m; sourceTree = "<group>"; }; | ||
| 209 | D2029B811E6EAAA50027CD92 /* LiveVideoCloud.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LiveVideoCloud.app; sourceTree = BUILT_PRODUCTS_DIR; }; | 218 | D2029B811E6EAAA50027CD92 /* LiveVideoCloud.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LiveVideoCloud.app; sourceTree = BUILT_PRODUCTS_DIR; }; |
| 210 | D2029B851E6EAAA50027CD92 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; | 219 | D2029B851E6EAAA50027CD92 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; |
| 211 | - D2029B8E1E6EAAA50027CD92 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; }; | ||
| 212 | - D2029B901E6EAAA50027CD92 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; | ||
| 213 | D2029B931E6EAAA50027CD92 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; | 220 | D2029B931E6EAAA50027CD92 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; |
| 214 | D2029B951E6EAAA50027CD92 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; | 221 | D2029B951E6EAAA50027CD92 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; |
| 215 | D2029B9A1E6EAAA50027CD92 /* LiveVideoCloudTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LiveVideoCloudTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; | 222 | D2029B9A1E6EAAA50027CD92 /* LiveVideoCloudTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LiveVideoCloudTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; |
| @@ -529,6 +536,15 @@ | @@ -529,6 +536,15 @@ | ||
| 529 | path = CNLiveSDK; | 536 | path = CNLiveSDK; |
| 530 | sourceTree = "<group>"; | 537 | sourceTree = "<group>"; |
| 531 | }; | 538 | }; |
| 539 | + 81FB5B391E7A6FFC00F98E1D /* SevenSwitch */ = { | ||
| 540 | + isa = PBXGroup; | ||
| 541 | + children = ( | ||
| 542 | + 81FB5B3A1E7A6FFC00F98E1D /* SevenSwitch.h */, | ||
| 543 | + 81FB5B3B1E7A6FFC00F98E1D /* SevenSwitch.m */, | ||
| 544 | + ); | ||
| 545 | + path = SevenSwitch; | ||
| 546 | + sourceTree = "<group>"; | ||
| 547 | + }; | ||
| 532 | D2029B781E6EAAA50027CD92 = { | 548 | D2029B781E6EAAA50027CD92 = { |
| 533 | isa = PBXGroup; | 549 | isa = PBXGroup; |
| 534 | children = ( | 550 | children = ( |
| @@ -558,7 +574,6 @@ | @@ -558,7 +574,6 @@ | ||
| 558 | D2029BD01E6EADE10027CD92 /* Classes */, | 574 | D2029BD01E6EADE10027CD92 /* Classes */, |
| 559 | D2029CD11E6EADE70027CD92 /* HttpService */, | 575 | D2029CD11E6EADE70027CD92 /* HttpService */, |
| 560 | D2029CD71E6EAE140027CD92 /* Resource */, | 576 | D2029CD71E6EAE140027CD92 /* Resource */, |
| 561 | - D2029B901E6EAAA50027CD92 /* Assets.xcassets */, | ||
| 562 | D2029CD61E6EADFB0027CD92 /* PrefixHeader.pch */, | 577 | D2029CD61E6EADFB0027CD92 /* PrefixHeader.pch */, |
| 563 | D2029B841E6EAAA50027CD92 /* Supporting Files */, | 578 | D2029B841E6EAAA50027CD92 /* Supporting Files */, |
| 564 | ); | 579 | ); |
| @@ -568,8 +583,8 @@ | @@ -568,8 +583,8 @@ | ||
| 568 | D2029B841E6EAAA50027CD92 /* Supporting Files */ = { | 583 | D2029B841E6EAAA50027CD92 /* Supporting Files */ = { |
| 569 | isa = PBXGroup; | 584 | isa = PBXGroup; |
| 570 | children = ( | 585 | children = ( |
| 586 | + 81FB5B021E7A251300F98E1D /* Assets.xcassets */, | ||
| 571 | D2029B921E6EAAA50027CD92 /* LaunchScreen.storyboard */, | 587 | D2029B921E6EAAA50027CD92 /* LaunchScreen.storyboard */, |
| 572 | - D2029B8D1E6EAAA50027CD92 /* Main.storyboard */, | ||
| 573 | D2029B851E6EAAA50027CD92 /* main.m */, | 588 | D2029B851E6EAAA50027CD92 /* main.m */, |
| 574 | D2029B951E6EAAA50027CD92 /* Info.plist */, | 589 | D2029B951E6EAAA50027CD92 /* Info.plist */, |
| 575 | ); | 590 | ); |
| @@ -654,6 +669,7 @@ | @@ -654,6 +669,7 @@ | ||
| 654 | D2029BD41E6EADE10027CD92 /* SDK */ = { | 669 | D2029BD41E6EADE10027CD92 /* SDK */ = { |
| 655 | isa = PBXGroup; | 670 | isa = PBXGroup; |
| 656 | children = ( | 671 | children = ( |
| 672 | + 81FB5B391E7A6FFC00F98E1D /* SevenSwitch */, | ||
| 657 | 810B64E41E779B1F00133E15 /* Masonry */, | 673 | 810B64E41E779B1F00133E15 /* Masonry */, |
| 658 | D2029BD51E6EADE10027CD92 /* AFNetworking */, | 674 | D2029BD51E6EADE10027CD92 /* AFNetworking */, |
| 659 | D2029BF81E6EADE10027CD92 /* MBProgressHUD */, | 675 | D2029BF81E6EADE10027CD92 /* MBProgressHUD */, |
| @@ -1254,6 +1270,8 @@ | @@ -1254,6 +1270,8 @@ | ||
| 1254 | D2888DB31E6EC154003A77C8 /* HomeViewController.m */, | 1270 | D2888DB31E6EC154003A77C8 /* HomeViewController.m */, |
| 1255 | 810B64E11E779AFE00133E15 /* LVCLivePlayerController.h */, | 1271 | 810B64E11E779AFE00133E15 /* LVCLivePlayerController.h */, |
| 1256 | 810B64E21E779AFE00133E15 /* LVCLivePlayerController.m */, | 1272 | 810B64E21E779AFE00133E15 /* LVCLivePlayerController.m */, |
| 1273 | + 810B65081E77B39D00133E15 /* LVCFullScreenPlayerController.h */, | ||
| 1274 | + 810B65091E77B39D00133E15 /* LVCFullScreenPlayerController.m */, | ||
| 1257 | ); | 1275 | ); |
| 1258 | path = Controller; | 1276 | path = Controller; |
| 1259 | sourceTree = "<group>"; | 1277 | sourceTree = "<group>"; |
| @@ -1270,6 +1288,8 @@ | @@ -1270,6 +1288,8 @@ | ||
| 1270 | children = ( | 1288 | children = ( |
| 1271 | 810B64DE1E779AE900133E15 /* LVCPlayer.h */, | 1289 | 810B64DE1E779AE900133E15 /* LVCPlayer.h */, |
| 1272 | 810B64DF1E779AE900133E15 /* LVCPlayer.m */, | 1290 | 810B64DF1E779AE900133E15 /* LVCPlayer.m */, |
| 1291 | + 8112D42F1E7927A5002E00F6 /* LVCPlayerLoadingView.h */, | ||
| 1292 | + 8112D4301E7927A5002E00F6 /* LVCPlayerLoadingView.m */, | ||
| 1273 | ); | 1293 | ); |
| 1274 | path = View; | 1294 | path = View; |
| 1275 | sourceTree = "<group>"; | 1295 | sourceTree = "<group>"; |
| @@ -1418,15 +1438,14 @@ | @@ -1418,15 +1438,14 @@ | ||
| 1418 | files = ( | 1438 | files = ( |
| 1419 | D2029C971E6EADE10027CD92 /* Info.plist in Resources */, | 1439 | D2029C971E6EADE10027CD92 /* Info.plist in Resources */, |
| 1420 | D2575C7F1E76A4F300E3A8FC /* NHPlaneViews.xib in Resources */, | 1440 | D2575C7F1E76A4F300E3A8FC /* NHPlaneViews.xib in Resources */, |
| 1441 | + 81FB5B031E7A251300F98E1D /* Assets.xcassets in Resources */, | ||
| 1421 | D2575C7B1E76A4F300E3A8FC /* NHCarViews.xib in Resources */, | 1442 | D2575C7B1E76A4F300E3A8FC /* NHCarViews.xib in Resources */, |
| 1422 | D2029CC91E6EADE10027CD92 /* SVProgressHUD.bundle in Resources */, | 1443 | D2029CC91E6EADE10027CD92 /* SVProgressHUD.bundle in Resources */, |
| 1423 | D2575C801E76A4F300E3A8FC /* resource.bundle in Resources */, | 1444 | D2575C801E76A4F300E3A8FC /* resource.bundle in Resources */, |
| 1424 | D2029B941E6EAAA50027CD92 /* LaunchScreen.storyboard in Resources */, | 1445 | D2029B941E6EAAA50027CD92 /* LaunchScreen.storyboard in Resources */, |
| 1425 | - D2029B911E6EAAA50027CD92 /* Assets.xcassets in Resources */, | ||
| 1426 | D2029CB01E6EADE10027CD92 /* MJRefresh.bundle in Resources */, | 1446 | D2029CB01E6EADE10027CD92 /* MJRefresh.bundle in Resources */, |
| 1427 | D2575C7C1E76A4F300E3A8FC /* NHFighterView.nib in Resources */, | 1447 | D2575C7C1E76A4F300E3A8FC /* NHFighterView.nib in Resources */, |
| 1428 | 812E50541E7699DC004F5FCD /* KSYGPUResource.bundle in Resources */, | 1448 | 812E50541E7699DC004F5FCD /* KSYGPUResource.bundle in Resources */, |
| 1429 | - D2029B8F1E6EAAA50027CD92 /* Main.storyboard in Resources */, | ||
| 1430 | ); | 1449 | ); |
| 1431 | runOnlyForDeploymentPostprocessing = 0; | 1450 | runOnlyForDeploymentPostprocessing = 0; |
| 1432 | }; | 1451 | }; |
| @@ -1543,6 +1562,7 @@ | @@ -1543,6 +1562,7 @@ | ||
| 1543 | D2029CA81E6EADE10027CD92 /* MJRefreshAutoNormalFooter.m in Sources */, | 1562 | D2029CA81E6EADE10027CD92 /* MJRefreshAutoNormalFooter.m in Sources */, |
| 1544 | D2029C891E6EADE10027CD92 /* AFSecurityPolicy.m in Sources */, | 1563 | D2029C891E6EADE10027CD92 /* AFSecurityPolicy.m in Sources */, |
| 1545 | D2029CBA1E6EADE10027CD92 /* SDWebImageDecoder.m in Sources */, | 1564 | D2029CBA1E6EADE10027CD92 /* SDWebImageDecoder.m in Sources */, |
| 1565 | + 8112D4311E7927A5002E00F6 /* LVCPlayerLoadingView.m in Sources */, | ||
| 1546 | D2029D081E6EAE2E0027CD92 /* ZXDeviceInfo.m in Sources */, | 1566 | D2029D081E6EAE2E0027CD92 /* ZXDeviceInfo.m in Sources */, |
| 1547 | D2029CC21E6EADE10027CD92 /* UIImage+WebP.m in Sources */, | 1567 | D2029CC21E6EADE10027CD92 /* UIImage+WebP.m in Sources */, |
| 1548 | D2029BCD1E6EADD70027CD92 /* BaseViewController.m in Sources */, | 1568 | D2029BCD1E6EADD70027CD92 /* BaseViewController.m in Sources */, |
| @@ -1551,9 +1571,11 @@ | @@ -1551,9 +1571,11 @@ | ||
| 1551 | D2029D001E6EAE2E0027CD92 /* NSNumber+ScaleHeight.m in Sources */, | 1571 | D2029D001E6EAE2E0027CD92 /* NSNumber+ScaleHeight.m in Sources */, |
| 1552 | D2888D9E1E6EBF1B003A77C8 /* LVCLiveViewController.m in Sources */, | 1572 | D2888D9E1E6EBF1B003A77C8 /* LVCLiveViewController.m in Sources */, |
| 1553 | D2029C951E6EADE10027CD92 /* UIWebView+AFNetworking.m in Sources */, | 1573 | D2029C951E6EADE10027CD92 /* UIWebView+AFNetworking.m in Sources */, |
| 1574 | + 810B650A1E77B39D00133E15 /* LVCFullScreenPlayerController.m in Sources */, | ||
| 1554 | D2575C6B1E76A45400E3A8FC /* LVCGiftManager.m in Sources */, | 1575 | D2575C6B1E76A45400E3A8FC /* LVCGiftManager.m in Sources */, |
| 1555 | D2029CBD1E6EADE10027CD92 /* SDWebImageManager.m in Sources */, | 1576 | D2029CBD1E6EADE10027CD92 /* SDWebImageManager.m in Sources */, |
| 1556 | D2029CB41E6EADE10027CD92 /* UIView+MJExtension.m in Sources */, | 1577 | D2029CB41E6EADE10027CD92 /* UIView+MJExtension.m in Sources */, |
| 1578 | + 81FB5B3C1E7A6FFC00F98E1D /* SevenSwitch.m in Sources */, | ||
| 1557 | D2029CA91E6EADE10027CD92 /* MJRefreshAutoStateFooter.m in Sources */, | 1579 | D2029CA91E6EADE10027CD92 /* MJRefreshAutoStateFooter.m in Sources */, |
| 1558 | D2029D061E6EAE2E0027CD92 /* UIView+Extension.m in Sources */, | 1580 | D2029D061E6EAE2E0027CD92 /* UIView+Extension.m in Sources */, |
| 1559 | D2029C9D1E6EADE10027CD92 /* NSObject+MJClass.m in Sources */, | 1581 | D2029C9D1E6EADE10027CD92 /* NSObject+MJClass.m in Sources */, |
| @@ -1600,14 +1622,6 @@ | @@ -1600,14 +1622,6 @@ | ||
| 1600 | /* End PBXTargetDependency section */ | 1622 | /* End PBXTargetDependency section */ |
| 1601 | 1623 | ||
| 1602 | /* Begin PBXVariantGroup section */ | 1624 | /* Begin PBXVariantGroup section */ |
| 1603 | - D2029B8D1E6EAAA50027CD92 /* Main.storyboard */ = { | ||
| 1604 | - isa = PBXVariantGroup; | ||
| 1605 | - children = ( | ||
| 1606 | - D2029B8E1E6EAAA50027CD92 /* Base */, | ||
| 1607 | - ); | ||
| 1608 | - name = Main.storyboard; | ||
| 1609 | - sourceTree = "<group>"; | ||
| 1610 | - }; | ||
| 1611 | D2029B921E6EAAA50027CD92 /* LaunchScreen.storyboard */ = { | 1625 | D2029B921E6EAAA50027CD92 /* LaunchScreen.storyboard */ = { |
| 1612 | isa = PBXVariantGroup; | 1626 | isa = PBXVariantGroup; |
| 1613 | children = ( | 1627 | children = ( |
| @@ -1726,7 +1740,7 @@ | @@ -1726,7 +1740,7 @@ | ||
| 1726 | "$(inherited)", | 1740 | "$(inherited)", |
| 1727 | "$(PROJECT_DIR)/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftResource", | 1741 | "$(PROJECT_DIR)/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftResource", |
| 1728 | ); | 1742 | ); |
| 1729 | - PRODUCT_BUNDLE_IDENTIFIER = com.cnlive.zhangxu.LiveVideoCloud; | 1743 | + PRODUCT_BUNDLE_IDENTIFIER = com.cnlive.video; |
| 1730 | PRODUCT_NAME = "$(TARGET_NAME)"; | 1744 | PRODUCT_NAME = "$(TARGET_NAME)"; |
| 1731 | }; | 1745 | }; |
| 1732 | name = Debug; | 1746 | name = Debug; |
| @@ -1748,7 +1762,7 @@ | @@ -1748,7 +1762,7 @@ | ||
| 1748 | "$(inherited)", | 1762 | "$(inherited)", |
| 1749 | "$(PROJECT_DIR)/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftResource", | 1763 | "$(PROJECT_DIR)/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftResource", |
| 1750 | ); | 1764 | ); |
| 1751 | - PRODUCT_BUNDLE_IDENTIFIER = com.cnlive.zhangxu.LiveVideoCloud; | 1765 | + PRODUCT_BUNDLE_IDENTIFIER = com.cnlive.video; |
| 1752 | PRODUCT_NAME = "$(TARGET_NAME)"; | 1766 | PRODUCT_NAME = "$(TARGET_NAME)"; |
| 1753 | }; | 1767 | }; |
| 1754 | name = Release; | 1768 | name = Release; |
LiveVideoCloud/LiveVideoCloud/AppCustoms/Main/ZXTabBarController.m
LiveVideoCloud/LiveVideoCloud/Assets.xcassets/player/Barrage input.imageset/Barrage input.png
0 → 100644
3.78 KB
LiveVideoCloud/LiveVideoCloud/Assets.xcassets/player/Barrage input.imageset/Contents.json
0 → 100644
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "idiom" : "universal", | ||
| 5 | + "filename" : "Barrage input.png", | ||
| 6 | + "scale" : "1x" | ||
| 7 | + }, | ||
| 8 | + { | ||
| 9 | + "idiom" : "universal", | ||
| 10 | + "scale" : "2x" | ||
| 11 | + }, | ||
| 12 | + { | ||
| 13 | + "idiom" : "universal", | ||
| 14 | + "scale" : "3x" | ||
| 15 | + } | ||
| 16 | + ], | ||
| 17 | + "info" : { | ||
| 18 | + "version" : 1, | ||
| 19 | + "author" : "xcode" | ||
| 20 | + } | ||
| 21 | +} | ||
| 0 | \ No newline at end of file | 22 | \ No newline at end of file |
LiveVideoCloud/LiveVideoCloud/Assets.xcassets/player/Contents.json
0 → 100644
LiveVideoCloud/LiveVideoCloud/Assets.xcassets/bottom_shadow.imageset/Contents.json renamed to LiveVideoCloud/LiveVideoCloud/Assets.xcassets/player/bottom_shadow.imageset/Contents.json
LiveVideoCloud/LiveVideoCloud/Assets.xcassets/bottom_shadow.imageset/bottom_shadow.png renamed to LiveVideoCloud/LiveVideoCloud/Assets.xcassets/player/bottom_shadow.imageset/bottom_shadow.png
1.12 KB
LiveVideoCloud/LiveVideoCloud/Assets.xcassets/dot.imageset/Contents.json renamed to LiveVideoCloud/LiveVideoCloud/Assets.xcassets/player/dot.imageset/Contents.json
LiveVideoCloud/LiveVideoCloud/Assets.xcassets/dot.imageset/dot@3x.png renamed to LiveVideoCloud/LiveVideoCloud/Assets.xcassets/player/dot.imageset/dot@3x.png
335 Bytes
LiveVideoCloud/LiveVideoCloud/Assets.xcassets/fullscreen.imageset/Contents.json renamed to LiveVideoCloud/LiveVideoCloud/Assets.xcassets/player/fullscreen.imageset/Contents.json
LiveVideoCloud/LiveVideoCloud/Assets.xcassets/fullscreen.imageset/fullscreen@3x.png renamed to LiveVideoCloud/LiveVideoCloud/Assets.xcassets/player/fullscreen.imageset/fullscreen@3x.png
1.18 KB
LiveVideoCloud/LiveVideoCloud/Assets.xcassets/nonfullscreen.imageset/Contents.json renamed to LiveVideoCloud/LiveVideoCloud/Assets.xcassets/player/nonfullscreen.imageset/Contents.json
LiveVideoCloud/LiveVideoCloud/Assets.xcassets/nonfullscreen.imageset/nonfullscreen@3x.png renamed to LiveVideoCloud/LiveVideoCloud/Assets.xcassets/player/nonfullscreen.imageset/nonfullscreen@3x.png
1.19 KB
LiveVideoCloud/LiveVideoCloud/Assets.xcassets/pause.imageset/Contents.json renamed to LiveVideoCloud/LiveVideoCloud/Assets.xcassets/player/pause.imageset/Contents.json
LiveVideoCloud/LiveVideoCloud/Assets.xcassets/pause.imageset/pause@3x.png renamed to LiveVideoCloud/LiveVideoCloud/Assets.xcassets/player/pause.imageset/pause@3x.png
188 Bytes
LiveVideoCloud/LiveVideoCloud/Assets.xcassets/player/placeholderImage.imageset/Contents.json
0 → 100644
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "idiom" : "universal", | ||
| 5 | + "filename" : "load_03.png", | ||
| 6 | + "scale" : "1x" | ||
| 7 | + }, | ||
| 8 | + { | ||
| 9 | + "idiom" : "universal", | ||
| 10 | + "scale" : "2x" | ||
| 11 | + }, | ||
| 12 | + { | ||
| 13 | + "idiom" : "universal", | ||
| 14 | + "scale" : "3x" | ||
| 15 | + } | ||
| 16 | + ], | ||
| 17 | + "info" : { | ||
| 18 | + "version" : 1, | ||
| 19 | + "author" : "xcode" | ||
| 20 | + } | ||
| 21 | +} | ||
| 0 | \ No newline at end of file | 22 | \ No newline at end of file |
LiveVideoCloud/LiveVideoCloud/Assets.xcassets/player/placeholderImage.imageset/load_03.png
0 → 100644
3.63 KB
LiveVideoCloud/LiveVideoCloud/Assets.xcassets/play.imageset/Contents.json renamed to LiveVideoCloud/LiveVideoCloud/Assets.xcassets/player/play.imageset/Contents.json
LiveVideoCloud/LiveVideoCloud/Assets.xcassets/play.imageset/play@3x.png renamed to LiveVideoCloud/LiveVideoCloud/Assets.xcassets/player/play.imageset/play@3x.png
660 Bytes
LiveVideoCloud/LiveVideoCloud/Assets.xcassets/play_back.imageset/Contents.json renamed to LiveVideoCloud/LiveVideoCloud/Assets.xcassets/player/play_back.imageset/Contents.json
LiveVideoCloud/LiveVideoCloud/Assets.xcassets/play_back.imageset/play_back.png renamed to LiveVideoCloud/LiveVideoCloud/Assets.xcassets/player/play_back.imageset/play_back.png
1.47 KB
LiveVideoCloud/LiveVideoCloud/Assets.xcassets/top_shadow.imageset/Contents.json renamed to LiveVideoCloud/LiveVideoCloud/Assets.xcassets/player/top_shadow.imageset/Contents.json
LiveVideoCloud/LiveVideoCloud/Assets.xcassets/top_shadow.imageset/top_shadow.png renamed to LiveVideoCloud/LiveVideoCloud/Assets.xcassets/player/top_shadow.imageset/top_shadow.png
2.95 KB
LiveVideoCloud/LiveVideoCloud/Assets.xcassets/player/全屏加载图.imageset/Contents.json
0 → 100644
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "idiom" : "universal", | ||
| 5 | + "filename" : "全屏加载图.png", | ||
| 6 | + "scale" : "1x" | ||
| 7 | + }, | ||
| 8 | + { | ||
| 9 | + "idiom" : "universal", | ||
| 10 | + "scale" : "2x" | ||
| 11 | + }, | ||
| 12 | + { | ||
| 13 | + "idiom" : "universal", | ||
| 14 | + "scale" : "3x" | ||
| 15 | + } | ||
| 16 | + ], | ||
| 17 | + "info" : { | ||
| 18 | + "version" : 1, | ||
| 19 | + "author" : "xcode" | ||
| 20 | + } | ||
| 21 | +} | ||
| 0 | \ No newline at end of file | 22 | \ No newline at end of file |
LiveVideoCloud/LiveVideoCloud/Assets.xcassets/player/全屏加载图.imageset/全屏加载图.png
0 → 100644
23.1 KB
LiveVideoCloud/LiveVideoCloud/Assets.xcassets/player/弹off.imageset/Contents.json
0 → 100644
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "idiom" : "universal", | ||
| 5 | + "filename" : "弹off.png", | ||
| 6 | + "scale" : "1x" | ||
| 7 | + }, | ||
| 8 | + { | ||
| 9 | + "idiom" : "universal", | ||
| 10 | + "scale" : "2x" | ||
| 11 | + }, | ||
| 12 | + { | ||
| 13 | + "idiom" : "universal", | ||
| 14 | + "scale" : "3x" | ||
| 15 | + } | ||
| 16 | + ], | ||
| 17 | + "info" : { | ||
| 18 | + "version" : 1, | ||
| 19 | + "author" : "xcode" | ||
| 20 | + } | ||
| 21 | +} | ||
| 0 | \ No newline at end of file | 22 | \ No newline at end of file |
LiveVideoCloud/LiveVideoCloud/Assets.xcassets/player/弹off.imageset/弹off.png
0 → 100644
1.49 KB
LiveVideoCloud/LiveVideoCloud/Assets.xcassets/player/弹on.imageset/Contents.json
0 → 100644
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "idiom" : "universal", | ||
| 5 | + "filename" : "弹on.png", | ||
| 6 | + "scale" : "1x" | ||
| 7 | + }, | ||
| 8 | + { | ||
| 9 | + "idiom" : "universal", | ||
| 10 | + "scale" : "2x" | ||
| 11 | + }, | ||
| 12 | + { | ||
| 13 | + "idiom" : "universal", | ||
| 14 | + "scale" : "3x" | ||
| 15 | + } | ||
| 16 | + ], | ||
| 17 | + "info" : { | ||
| 18 | + "version" : 1, | ||
| 19 | + "author" : "xcode" | ||
| 20 | + } | ||
| 21 | +} | ||
| 0 | \ No newline at end of file | 22 | \ No newline at end of file |
LiveVideoCloud/LiveVideoCloud/Assets.xcassets/player/弹on.imageset/弹on.png
0 → 100644
1.26 KB
LiveVideoCloud/LiveVideoCloud/Assets.xcassets/返回.imageset/Contents.json renamed to LiveVideoCloud/LiveVideoCloud/Assets.xcassets/player/返回.imageset/Contents.json
LiveVideoCloud/LiveVideoCloud/Assets.xcassets/返回.imageset/返回@3x.png renamed to LiveVideoCloud/LiveVideoCloud/Assets.xcassets/player/返回.imageset/返回@3x.png
1.35 KB
LiveVideoCloud/LiveVideoCloud/Base.lproj/Main.storyboard deleted
100644 → 0
| 1 | -<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
| 2 | -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r"> | ||
| 3 | - <dependencies> | ||
| 4 | - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11106"/> | ||
| 5 | - <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> | ||
| 6 | - </dependencies> | ||
| 7 | - <scenes> | ||
| 8 | - <!--View Controller--> | ||
| 9 | - <scene sceneID="tne-QT-ifu"> | ||
| 10 | - <objects> | ||
| 11 | - <viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="" sceneMemberID="viewController"> | ||
| 12 | - <layoutGuides> | ||
| 13 | - <viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/> | ||
| 14 | - <viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/> | ||
| 15 | - </layoutGuides> | ||
| 16 | - <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC"> | ||
| 17 | - <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> | ||
| 18 | - <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | ||
| 19 | - <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | ||
| 20 | - </view> | ||
| 21 | - </viewController> | ||
| 22 | - <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/> | ||
| 23 | - </objects> | ||
| 24 | - </scene> | ||
| 25 | - </scenes> | ||
| 26 | -</document> |
LiveVideoCloud/LiveVideoCloud/Classes/SDK/SevenSwitch/SevenSwitch.h
0 → 100755
| 1 | +// | ||
| 2 | +// SevenSwitch | ||
| 3 | +// | ||
| 4 | +// Created by Benjamin Vogelzang on 6/10/13. | ||
| 5 | +// Copyright (c) 2013 Ben Vogelzang. All rights reserved. | ||
| 6 | +// | ||
| 7 | +// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| 8 | +// of this software and associated documentation files (the "Software"), to deal | ||
| 9 | +// in the Software without restriction, including without limitation the rights | ||
| 10 | +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| 11 | +// copies of the Software, and to permit persons to whom the Software is | ||
| 12 | +// furnished to do so, subject to the following conditions: | ||
| 13 | +// | ||
| 14 | +// The above copyright notice and this permission notice shall be included in | ||
| 15 | +// all copies or substantial portions of the Software. | ||
| 16 | +// | ||
| 17 | +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 18 | +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 19 | +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| 20 | +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 21 | +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| 22 | +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| 23 | +// THE SOFTWARE. | ||
| 24 | + | ||
| 25 | +#import <UIKit/UIKit.h> | ||
| 26 | + | ||
| 27 | +@protocol SevenSwitchDelegate <NSObject> | ||
| 28 | + | ||
| 29 | +- (void)sevenSwitchChanged:(BOOL)change; | ||
| 30 | + | ||
| 31 | +@end | ||
| 32 | + | ||
| 33 | +@interface SevenSwitch : UIControl | ||
| 34 | + | ||
| 35 | +@property (nonatomic, weak) id<SevenSwitchDelegate> delegate; | ||
| 36 | + | ||
| 37 | +/* | ||
| 38 | + * Set (without animation) whether the switch is on or off | ||
| 39 | + */ | ||
| 40 | +@property (nonatomic, assign) BOOL on; | ||
| 41 | + | ||
| 42 | + | ||
| 43 | +/* | ||
| 44 | + * Sets the background color when the switch is off. | ||
| 45 | + * Defaults to clear color. | ||
| 46 | + */ | ||
| 47 | +@property (nonatomic, strong) UIColor *inactiveColor; | ||
| 48 | + | ||
| 49 | +/* | ||
| 50 | + * Sets the background color that shows when the switch off and actively being touched. | ||
| 51 | + * Defaults to light gray. | ||
| 52 | + */ | ||
| 53 | +@property (nonatomic, strong) UIColor *activeColor; | ||
| 54 | + | ||
| 55 | +/* | ||
| 56 | + * Sets the background color that shows when the switch is on. | ||
| 57 | + * Defaults to green. | ||
| 58 | + */ | ||
| 59 | +@property (nonatomic, strong) UIColor *onColor; | ||
| 60 | + | ||
| 61 | +/* | ||
| 62 | + * Sets the border color that shows when the switch is off. Defaults to light gray. | ||
| 63 | + */ | ||
| 64 | +@property (nonatomic, strong) UIColor *borderColor; | ||
| 65 | + | ||
| 66 | +/* | ||
| 67 | + * Sets the knob color. Defaults to white. | ||
| 68 | + */ | ||
| 69 | +@property (nonatomic, strong) UIColor *knobColor; | ||
| 70 | + | ||
| 71 | +@property (nonatomic, strong) UIImage *knobOnImage; | ||
| 72 | +@property (nonatomic, strong) UIImage *knobOffImage; | ||
| 73 | +@property (nonatomic, strong) UIColor *knobOnColor; | ||
| 74 | +@property (nonatomic, strong) UIColor *knobOffColor; | ||
| 75 | + | ||
| 76 | +/* | ||
| 77 | + * Sets the shadow color of the knob. Defaults to gray. | ||
| 78 | + */ | ||
| 79 | +@property (nonatomic, strong) UIColor *shadowColor; | ||
| 80 | + | ||
| 81 | + | ||
| 82 | +/* | ||
| 83 | + * Sets whether or not the switch edges are rounded. | ||
| 84 | + * Set to NO to get a stylish square switch. | ||
| 85 | + * Defaults to YES. | ||
| 86 | + */ | ||
| 87 | +@property (nonatomic, assign) BOOL isRounded; | ||
| 88 | + | ||
| 89 | +@property (nonatomic, assign) CGFloat cornerRadius; | ||
| 90 | + | ||
| 91 | + | ||
| 92 | +/* | ||
| 93 | + * Sets the image that shows when the switch is on. | ||
| 94 | + * The image is centered in the area not covered by the knob. | ||
| 95 | + * Make sure to size your images appropriately. | ||
| 96 | + */ | ||
| 97 | +@property (nonatomic, strong) UIImage *onImage; | ||
| 98 | + | ||
| 99 | +/* | ||
| 100 | + * Sets the image that shows when the switch is off. | ||
| 101 | + * The image is centered in the area not covered by the knob. | ||
| 102 | + * Make sure to size your images appropriately. | ||
| 103 | + */ | ||
| 104 | +@property (nonatomic, strong) UIImage *offImage; | ||
| 105 | + | ||
| 106 | + | ||
| 107 | +/* | ||
| 108 | + * Set whether the switch is on or off. Optionally animate the change | ||
| 109 | + */ | ||
| 110 | +- (void)setOn:(BOOL)on animated:(BOOL)animated; | ||
| 111 | + | ||
| 112 | +/* | ||
| 113 | + * Detects whether the switch is on or off | ||
| 114 | + * | ||
| 115 | + * @return BOOL YES if switch is on. NO if switch is off | ||
| 116 | + */ | ||
| 117 | +- (BOOL)isOn; | ||
| 118 | + | ||
| 119 | +@end |
LiveVideoCloud/LiveVideoCloud/Classes/SDK/SevenSwitch/SevenSwitch.m
0 → 100755
| 1 | +// | ||
| 2 | +// SevenSwitch | ||
| 3 | +// | ||
| 4 | +// Created by Benjamin Vogelzang on 6/10/13. | ||
| 5 | +// Copyright (c) 2013 Ben Vogelzang. All rights reserved. | ||
| 6 | +// | ||
| 7 | +// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| 8 | +// of this software and associated documentation files (the "Software"), to deal | ||
| 9 | +// in the Software without restriction, including without limitation the rights | ||
| 10 | +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| 11 | +// copies of the Software, and to permit persons to whom the Software is | ||
| 12 | +// furnished to do so, subject to the following conditions: | ||
| 13 | +// | ||
| 14 | +// The above copyright notice and this permission notice shall be included in | ||
| 15 | +// all copies or substantial portions of the Software. | ||
| 16 | +// | ||
| 17 | +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 18 | +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 19 | +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| 20 | +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 21 | +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| 22 | +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| 23 | +// THE SOFTWARE. | ||
| 24 | + | ||
| 25 | +#import "SevenSwitch.h" | ||
| 26 | +#import <QuartzCore/QuartzCore.h> | ||
| 27 | + | ||
| 28 | +@interface SevenSwitch () { | ||
| 29 | + UIView *background; | ||
| 30 | + UIImageView *knob; | ||
| 31 | + UIImageView *onImageView; | ||
| 32 | + UIImageView *offImageView; | ||
| 33 | + double startTime; | ||
| 34 | + BOOL isAnimating; | ||
| 35 | +} | ||
| 36 | + | ||
| 37 | +- (void)showOn:(BOOL)animated; | ||
| 38 | +- (void)showOff:(BOOL)animated; | ||
| 39 | +- (void)setup; | ||
| 40 | + | ||
| 41 | +@end | ||
| 42 | + | ||
| 43 | + | ||
| 44 | +@implementation SevenSwitch | ||
| 45 | + | ||
| 46 | +@synthesize inactiveColor, activeColor, onColor, borderColor, knobColor, shadowColor; | ||
| 47 | +@synthesize onImage, offImage; | ||
| 48 | +@synthesize isRounded; | ||
| 49 | +@synthesize on; | ||
| 50 | + | ||
| 51 | + | ||
| 52 | +#pragma mark init Methods | ||
| 53 | + | ||
| 54 | +- (id)init { | ||
| 55 | + self = [super initWithFrame:CGRectMake(0, 0, 50, 30)]; | ||
| 56 | + if (self) { | ||
| 57 | + [self setup]; | ||
| 58 | + } | ||
| 59 | + return self; | ||
| 60 | +} | ||
| 61 | + | ||
| 62 | +- (id)initWithCoder:(NSCoder *)aDecoder { | ||
| 63 | + self = [super initWithCoder:aDecoder]; | ||
| 64 | + if (self) { | ||
| 65 | + [self setup]; | ||
| 66 | + } | ||
| 67 | + return self; | ||
| 68 | +} | ||
| 69 | + | ||
| 70 | +- (id)initWithFrame:(CGRect)frame | ||
| 71 | +{ | ||
| 72 | + // use the default values if CGRectZero frame is set | ||
| 73 | + CGRect initialFrame; | ||
| 74 | + if (CGRectIsEmpty(frame)) { | ||
| 75 | + initialFrame = CGRectMake(0, 0, 50, 30); | ||
| 76 | + } | ||
| 77 | + else { | ||
| 78 | + initialFrame = frame; | ||
| 79 | + } | ||
| 80 | + self = [super initWithFrame:initialFrame]; | ||
| 81 | + if (self) { | ||
| 82 | + [self setup]; | ||
| 83 | + } | ||
| 84 | + return self; | ||
| 85 | +} | ||
| 86 | + | ||
| 87 | + | ||
| 88 | +/** | ||
| 89 | + * Setup the individual elements of the switch and set default values | ||
| 90 | + */ | ||
| 91 | +- (void)setup { | ||
| 92 | + | ||
| 93 | + // default values | ||
| 94 | + self.on = NO; | ||
| 95 | + self.isRounded = YES; | ||
| 96 | + self.inactiveColor = [UIColor clearColor]; | ||
| 97 | + self.activeColor = [UIColor colorWithRed:0.89f green:0.89f blue:0.89f alpha:1.00f]; | ||
| 98 | + self.onColor = [UIColor colorWithRed:0.30f green:0.85f blue:0.39f alpha:1.00f]; | ||
| 99 | + self.borderColor = [UIColor colorWithRed:0.89f green:0.89f blue:0.91f alpha:1.00f]; | ||
| 100 | + self.knobColor = [UIColor whiteColor]; | ||
| 101 | + self.shadowColor = [UIColor grayColor]; | ||
| 102 | + self.cornerRadius = 2; | ||
| 103 | + | ||
| 104 | + // background | ||
| 105 | + background = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)]; | ||
| 106 | + background.backgroundColor = [UIColor clearColor]; | ||
| 107 | + background.layer.cornerRadius = self.frame.size.height * 0.5; | ||
| 108 | +// background.layer.borderColor = self.borderColor.CGColor; | ||
| 109 | +// background.layer.borderWidth = 1.0; | ||
| 110 | + background.userInteractionEnabled = NO; | ||
| 111 | + [self addSubview:background]; | ||
| 112 | + | ||
| 113 | + // images | ||
| 114 | + onImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width - self.frame.size.height, self.frame.size.height)]; | ||
| 115 | + onImageView.alpha = 0; | ||
| 116 | + onImageView.contentMode = UIViewContentModeCenter; | ||
| 117 | + [self addSubview:onImageView]; | ||
| 118 | + | ||
| 119 | + offImageView = [[UIImageView alloc] initWithFrame:CGRectMake(self.frame.size.height, 0, self.frame.size.width - self.frame.size.height, self.frame.size.height)]; | ||
| 120 | + offImageView.alpha = 1.0; | ||
| 121 | + offImageView.contentMode = UIViewContentModeCenter; | ||
| 122 | + [self addSubview:offImageView]; | ||
| 123 | + | ||
| 124 | + // knob | ||
| 125 | + knob = [[UIImageView alloc] initWithFrame:CGRectMake(1, 1, self.frame.size.height - 2, self.frame.size.height - 2)]; | ||
| 126 | + knob.backgroundColor = self.knobColor; | ||
| 127 | + knob.layer.cornerRadius = (self.frame.size.height * 0.5) - 1; | ||
| 128 | + knob.layer.shadowColor = self.shadowColor.CGColor; | ||
| 129 | + knob.layer.shadowRadius = 2.0; | ||
| 130 | + knob.layer.shadowOpacity = 0.5; | ||
| 131 | + knob.layer.shadowOffset = CGSizeMake(0, 3); | ||
| 132 | + knob.layer.masksToBounds = NO; | ||
| 133 | + knob.userInteractionEnabled = NO; | ||
| 134 | + [self addSubview:knob]; | ||
| 135 | + | ||
| 136 | + isAnimating = NO; | ||
| 137 | +} | ||
| 138 | + | ||
| 139 | + | ||
| 140 | +#pragma mark Touch Tracking | ||
| 141 | + | ||
| 142 | +- (BOOL)beginTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event { | ||
| 143 | + [super beginTrackingWithTouch:touch withEvent:event]; | ||
| 144 | + | ||
| 145 | + // start timer to detect tap later in endTrackingWithTouch:withEvent: | ||
| 146 | + startTime = [[NSDate date] timeIntervalSince1970]; | ||
| 147 | + | ||
| 148 | + // make the knob larger and animate to the correct color | ||
| 149 | + CGFloat activeKnobWidth = self.bounds.size.height - 2 + 5; | ||
| 150 | + isAnimating = YES; | ||
| 151 | + [UIView animateWithDuration:0.3 delay:0.0 options:UIViewAnimationOptionCurveEaseOut|UIViewAnimationOptionBeginFromCurrentState animations:^{ | ||
| 152 | + if (self.on) { | ||
| 153 | + knob.frame = CGRectMake(self.bounds.size.width - (activeKnobWidth + 1), knob.frame.origin.y, activeKnobWidth, knob.frame.size.height); | ||
| 154 | + background.backgroundColor = self.onColor; | ||
| 155 | + knob.image = self.knobOnImage; | ||
| 156 | + knob.backgroundColor = self.knobOnColor; | ||
| 157 | + } | ||
| 158 | + else { | ||
| 159 | + knob.frame = CGRectMake(knob.frame.origin.x, knob.frame.origin.y, activeKnobWidth, knob.frame.size.height); | ||
| 160 | + background.backgroundColor = self.activeColor; | ||
| 161 | + knob.image = self.knobOffImage; | ||
| 162 | + knob.backgroundColor = self.knobOffColor; | ||
| 163 | + } | ||
| 164 | + } completion:^(BOOL finished) { | ||
| 165 | + isAnimating = NO; | ||
| 166 | + }]; | ||
| 167 | + | ||
| 168 | + return YES; | ||
| 169 | +} | ||
| 170 | + | ||
| 171 | +- (BOOL)continueTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event { | ||
| 172 | + [super continueTrackingWithTouch:touch withEvent:event]; | ||
| 173 | + | ||
| 174 | + // Get touch location | ||
| 175 | + CGPoint lastPoint = [touch locationInView:self]; | ||
| 176 | + | ||
| 177 | + // update the switch to the correct visuals depending on if | ||
| 178 | + // they moved their touch to the right or left side of the switch | ||
| 179 | + if (lastPoint.x > self.bounds.size.width * 0.5) | ||
| 180 | + [self showOn:YES]; | ||
| 181 | + else | ||
| 182 | + [self showOff:YES]; | ||
| 183 | + | ||
| 184 | + return YES; | ||
| 185 | +} | ||
| 186 | + | ||
| 187 | +- (void)endTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event { | ||
| 188 | + [super endTrackingWithTouch:touch withEvent:event]; | ||
| 189 | + | ||
| 190 | + // capture time to see if this was a tap action | ||
| 191 | + double endTime = [[NSDate date] timeIntervalSince1970]; | ||
| 192 | + double difference = endTime - startTime; | ||
| 193 | + BOOL previousValue = self.on; | ||
| 194 | + | ||
| 195 | + // determine if the user tapped the switch or has held it for longer | ||
| 196 | + if (difference <= 0.2) { | ||
| 197 | + CGFloat normalKnobWidth = self.bounds.size.height - 2; | ||
| 198 | + knob.frame = CGRectMake(knob.frame.origin.x, knob.frame.origin.y, normalKnobWidth, knob.frame.size.height); | ||
| 199 | + knob.image = self.knobOffImage; | ||
| 200 | + knob.backgroundColor = self.knobOffColor; | ||
| 201 | + | ||
| 202 | + [self setOn:!self.on animated:YES]; | ||
| 203 | + } | ||
| 204 | + else { | ||
| 205 | + // Get touch location | ||
| 206 | + CGPoint lastPoint = [touch locationInView:self]; | ||
| 207 | + | ||
| 208 | + // update the switch to the correct value depending on if | ||
| 209 | + // their touch finished on the right or left side of the switch | ||
| 210 | + if (lastPoint.x > self.bounds.size.width * 0.5) | ||
| 211 | + [self setOn:YES animated:YES]; | ||
| 212 | + else | ||
| 213 | + [self setOn:NO animated:YES]; | ||
| 214 | + } | ||
| 215 | + | ||
| 216 | + if (previousValue != self.on) | ||
| 217 | + [self sendActionsForControlEvents:UIControlEventValueChanged]; | ||
| 218 | +} | ||
| 219 | + | ||
| 220 | +- (void)cancelTrackingWithEvent:(UIEvent *)event { | ||
| 221 | + [super cancelTrackingWithEvent:event]; | ||
| 222 | + | ||
| 223 | + // just animate back to the original value | ||
| 224 | + if (self.on) | ||
| 225 | + [self showOn:YES]; | ||
| 226 | + else | ||
| 227 | + [self showOff:YES]; | ||
| 228 | +} | ||
| 229 | + | ||
| 230 | + | ||
| 231 | +- (void)layoutSubviews { | ||
| 232 | + [super layoutSubviews]; | ||
| 233 | + | ||
| 234 | + if (!isAnimating) { | ||
| 235 | + CGRect frame = self.frame; | ||
| 236 | + | ||
| 237 | + // background | ||
| 238 | + background.frame = CGRectMake(0, 0, frame.size.width, frame.size.height); | ||
| 239 | + background.layer.cornerRadius = self.isRounded ? frame.size.height * 0.5 : self.cornerRadius; | ||
| 240 | + | ||
| 241 | + // images | ||
| 242 | + onImageView.frame = CGRectMake(0, 0, frame.size.width - frame.size.height, frame.size.height); | ||
| 243 | + offImageView.frame = CGRectMake(frame.size.height, 0, frame.size.width - frame.size.height, frame.size.height); | ||
| 244 | + | ||
| 245 | + // knob | ||
| 246 | + CGFloat normalKnobWidth = frame.size.height - 2; | ||
| 247 | + if (self.on) | ||
| 248 | + { | ||
| 249 | + knob.frame = CGRectMake(frame.size.width - (normalKnobWidth + 1), 1, frame.size.height - 2, normalKnobWidth); | ||
| 250 | + knob.image = self.knobOnImage; | ||
| 251 | + knob.backgroundColor = self.knobOnColor; | ||
| 252 | + } | ||
| 253 | + else | ||
| 254 | + { | ||
| 255 | + knob.frame = CGRectMake(1, 1, normalKnobWidth, normalKnobWidth); | ||
| 256 | + knob.image = self.knobOffImage; | ||
| 257 | + knob.backgroundColor = self.knobOffColor; | ||
| 258 | + } | ||
| 259 | + | ||
| 260 | + knob.layer.cornerRadius = self.isRounded ? (frame.size.height * 0.5) - 1 : 2; | ||
| 261 | + } | ||
| 262 | +} | ||
| 263 | + | ||
| 264 | + | ||
| 265 | +#pragma mark Setters | ||
| 266 | + | ||
| 267 | +/* | ||
| 268 | + * Sets the background color when the switch is off. | ||
| 269 | + * Defaults to clear color. | ||
| 270 | + */ | ||
| 271 | +- (void)setInactiveColor:(UIColor *)color { | ||
| 272 | + inactiveColor = color; | ||
| 273 | + if (!self.on && !self.isTracking) | ||
| 274 | + background.backgroundColor = color; | ||
| 275 | +} | ||
| 276 | + | ||
| 277 | +/* | ||
| 278 | + * Sets the background color that shows when the switch is on. | ||
| 279 | + * Defaults to green. | ||
| 280 | + */ | ||
| 281 | +- (void)setOnColor:(UIColor *)color { | ||
| 282 | + onColor = color; | ||
| 283 | + if (self.on && !self.isTracking) { | ||
| 284 | + background.backgroundColor = color; | ||
| 285 | +// background.layer.borderColor = color.CGColor; | ||
| 286 | + } | ||
| 287 | +} | ||
| 288 | + | ||
| 289 | +/* | ||
| 290 | + * Sets the border color that shows when the switch is off. Defaults to light gray. | ||
| 291 | + */ | ||
| 292 | +- (void)setBorderColor:(UIColor *)color { | ||
| 293 | + borderColor = color; | ||
| 294 | +// if (!self.on) | ||
| 295 | +// background.layer.borderColor = color.CGColor; | ||
| 296 | +} | ||
| 297 | + | ||
| 298 | +/* | ||
| 299 | + * Sets the knob color. Defaults to white. | ||
| 300 | + */ | ||
| 301 | +- (void)setKnobColor:(UIColor *)color { | ||
| 302 | + knobColor = color; | ||
| 303 | + knob.backgroundColor = color; | ||
| 304 | +} | ||
| 305 | + | ||
| 306 | +/* | ||
| 307 | + * Sets the shadow color of the knob. Defaults to gray. | ||
| 308 | + */ | ||
| 309 | +- (void)setShadowColor:(UIColor *)color { | ||
| 310 | + shadowColor = color; | ||
| 311 | + knob.layer.shadowColor = color.CGColor; | ||
| 312 | +} | ||
| 313 | + | ||
| 314 | + | ||
| 315 | +/* | ||
| 316 | + * Sets the image that shows when the switch is on. | ||
| 317 | + * The image is centered in the area not covered by the knob. | ||
| 318 | + * Make sure to size your images appropriately. | ||
| 319 | + */ | ||
| 320 | +- (void)setOnImage:(UIImage *)image { | ||
| 321 | + onImage = image; | ||
| 322 | + onImageView.image = image; | ||
| 323 | +} | ||
| 324 | + | ||
| 325 | +/* | ||
| 326 | + * Sets the image that shows when the switch is off. | ||
| 327 | + * The image is centered in the area not covered by the knob. | ||
| 328 | + * Make sure to size your images appropriately. | ||
| 329 | + */ | ||
| 330 | +- (void)setOffImage:(UIImage *)image { | ||
| 331 | + offImage = image; | ||
| 332 | + offImageView.image = image; | ||
| 333 | +} | ||
| 334 | + | ||
| 335 | + | ||
| 336 | +/* | ||
| 337 | + * Sets whether or not the switch edges are rounded. | ||
| 338 | + * Set to NO to get a stylish square switch. | ||
| 339 | + * Defaults to YES. | ||
| 340 | + */ | ||
| 341 | +- (void)setIsRounded:(BOOL)rounded { | ||
| 342 | + isRounded = rounded; | ||
| 343 | + | ||
| 344 | + if (rounded) { | ||
| 345 | + background.layer.cornerRadius = self.frame.size.height * 0.5; | ||
| 346 | + knob.layer.cornerRadius = (self.frame.size.height * 0.5) - 1; | ||
| 347 | + } | ||
| 348 | + else { | ||
| 349 | + background.layer.cornerRadius = self.cornerRadius; | ||
| 350 | + knob.layer.cornerRadius = 2; | ||
| 351 | + } | ||
| 352 | +} | ||
| 353 | + | ||
| 354 | + | ||
| 355 | +/* | ||
| 356 | + * Set (without animation) whether the switch is on or off | ||
| 357 | + */ | ||
| 358 | +- (void)setOn:(BOOL)isOn { | ||
| 359 | + [self setOn:isOn animated:NO]; | ||
| 360 | +} | ||
| 361 | + | ||
| 362 | + | ||
| 363 | +/* | ||
| 364 | + * Set the state of the switch to on or off, optionally animating the transition. | ||
| 365 | + */ | ||
| 366 | +- (void)setOn:(BOOL)isOn animated:(BOOL)animated { | ||
| 367 | + on = isOn; | ||
| 368 | + | ||
| 369 | + if ([self.delegate respondsToSelector:@selector(sevenSwitchChanged:)]) { | ||
| 370 | + [self.delegate sevenSwitchChanged:isOn]; | ||
| 371 | + } | ||
| 372 | + | ||
| 373 | + if (isOn) { | ||
| 374 | + [self showOn:animated]; | ||
| 375 | + } | ||
| 376 | + else { | ||
| 377 | + [self showOff:animated]; | ||
| 378 | + } | ||
| 379 | +} | ||
| 380 | + | ||
| 381 | + | ||
| 382 | +#pragma mark Getters | ||
| 383 | + | ||
| 384 | +/* | ||
| 385 | + * Detects whether the switch is on or off | ||
| 386 | + * | ||
| 387 | + * @return BOOL YES if switch is on. NO if switch is off | ||
| 388 | + */ | ||
| 389 | +- (BOOL)isOn { | ||
| 390 | + return self.on; | ||
| 391 | +} | ||
| 392 | + | ||
| 393 | + | ||
| 394 | +#pragma mark State Changes | ||
| 395 | + | ||
| 396 | + | ||
| 397 | +/* | ||
| 398 | + * update the looks of the switch to be in the on position | ||
| 399 | + * optionally make it animated | ||
| 400 | + */ | ||
| 401 | +- (void)showOn:(BOOL)animated { | ||
| 402 | + CGFloat normalKnobWidth = self.bounds.size.height - 2; | ||
| 403 | + CGFloat activeKnobWidth = normalKnobWidth + 5; | ||
| 404 | + if (animated) { | ||
| 405 | + isAnimating = YES; | ||
| 406 | + [UIView animateWithDuration:0.3 delay:0.0 options:UIViewAnimationOptionCurveEaseOut|UIViewAnimationOptionBeginFromCurrentState animations:^{ | ||
| 407 | + if (self.tracking) | ||
| 408 | + { | ||
| 409 | + knob.frame = CGRectMake(self.bounds.size.width - (activeKnobWidth + 1), knob.frame.origin.y, activeKnobWidth, knob.frame.size.height); | ||
| 410 | + } | ||
| 411 | + else | ||
| 412 | + { | ||
| 413 | + knob.frame = CGRectMake(self.bounds.size.width - (normalKnobWidth + 1), knob.frame.origin.y, normalKnobWidth, knob.frame.size.height); | ||
| 414 | + } | ||
| 415 | + knob.image = self.knobOnImage; | ||
| 416 | + knob.backgroundColor = self.knobOnColor; | ||
| 417 | + background.backgroundColor = self.onColor; | ||
| 418 | +// background.layer.borderColor = self.onColor.CGColor; | ||
| 419 | + onImageView.alpha = 1.0; | ||
| 420 | + offImageView.alpha = 0; | ||
| 421 | + } completion:^(BOOL finished) { | ||
| 422 | + isAnimating = NO; | ||
| 423 | + }]; | ||
| 424 | + } | ||
| 425 | + else { | ||
| 426 | + if (self.tracking) | ||
| 427 | + { | ||
| 428 | + knob.frame = CGRectMake(self.bounds.size.width - (activeKnobWidth + 1), knob.frame.origin.y, activeKnobWidth, knob.frame.size.height); | ||
| 429 | + } | ||
| 430 | + else | ||
| 431 | + { | ||
| 432 | + knob.frame = CGRectMake(self.bounds.size.width - (normalKnobWidth + 1), knob.frame.origin.y, normalKnobWidth, knob.frame.size.height); | ||
| 433 | + } | ||
| 434 | + knob.image = self.knobOnImage; | ||
| 435 | + knob.backgroundColor = self.knobOnColor; | ||
| 436 | + background.backgroundColor = self.onColor; | ||
| 437 | +// background.layer.borderColor = self.onColor.CGColor; | ||
| 438 | + onImageView.alpha = 1.0; | ||
| 439 | + offImageView.alpha = 0; | ||
| 440 | + } | ||
| 441 | +} | ||
| 442 | + | ||
| 443 | + | ||
| 444 | +/* | ||
| 445 | + * update the looks of the switch to be in the off position | ||
| 446 | + * optionally make it animated | ||
| 447 | + */ | ||
| 448 | +- (void)showOff:(BOOL)animated { | ||
| 449 | + CGFloat normalKnobWidth = self.bounds.size.height - 2; | ||
| 450 | + CGFloat activeKnobWidth = normalKnobWidth + 5; | ||
| 451 | + if (animated) { | ||
| 452 | + isAnimating = YES; | ||
| 453 | + [UIView animateWithDuration:0.3 delay:0.0 options:UIViewAnimationOptionCurveEaseOut|UIViewAnimationOptionBeginFromCurrentState animations:^{ | ||
| 454 | + if (self.tracking) { | ||
| 455 | + knob.frame = CGRectMake(1, knob.frame.origin.y, activeKnobWidth, knob.frame.size.height); | ||
| 456 | + background.backgroundColor = self.activeColor; | ||
| 457 | + } | ||
| 458 | + else { | ||
| 459 | + knob.frame = CGRectMake(1, knob.frame.origin.y, normalKnobWidth, knob.frame.size.height); | ||
| 460 | + background.backgroundColor = self.inactiveColor; | ||
| 461 | + } | ||
| 462 | + knob.image = self.knobOffImage; | ||
| 463 | + knob.backgroundColor = self.knobOffColor; | ||
| 464 | +// background.layer.borderColor = self.borderColor.CGColor; | ||
| 465 | + onImageView.alpha = 0; | ||
| 466 | + offImageView.alpha = 1.0; | ||
| 467 | + } completion:^(BOOL finished) { | ||
| 468 | + isAnimating = NO; | ||
| 469 | + }]; | ||
| 470 | + } | ||
| 471 | + else { | ||
| 472 | + if (self.tracking) { | ||
| 473 | + knob.frame = CGRectMake(1, knob.frame.origin.y, activeKnobWidth, knob.frame.size.height); | ||
| 474 | + background.backgroundColor = self.activeColor; | ||
| 475 | + } | ||
| 476 | + else { | ||
| 477 | + knob.frame = CGRectMake(1, knob.frame.origin.y, normalKnobWidth, knob.frame.size.height); | ||
| 478 | + background.backgroundColor = self.inactiveColor; | ||
| 479 | + } | ||
| 480 | + knob.image = self.knobOffImage; | ||
| 481 | + knob.backgroundColor = self.knobOffColor; | ||
| 482 | +// background.layer.borderColor = self.borderColor.CGColor; | ||
| 483 | + onImageView.alpha = 0; | ||
| 484 | + offImageView.alpha = 1.0; | ||
| 485 | + } | ||
| 486 | +} | ||
| 487 | + | ||
| 488 | +@end |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Controller/HomeViewController.m
| @@ -9,6 +9,7 @@ | @@ -9,6 +9,7 @@ | ||
| 9 | #import "HomeViewController.h" | 9 | #import "HomeViewController.h" |
| 10 | #import "LVCLivePlayerController.h" | 10 | #import "LVCLivePlayerController.h" |
| 11 | #import "LVCInteractionController.h" | 11 | #import "LVCInteractionController.h" |
| 12 | +#import "LVCLivePlayerController.h" | ||
| 12 | 13 | ||
| 13 | @interface HomeViewController () | 14 | @interface HomeViewController () |
| 14 | 15 |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Controller/LVCFullScreenPlayerController.h
0 → 100644
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Controller/LVCFullScreenPlayerController.m
0 → 100644
| 1 | +// | ||
| 2 | +// LVCFullScreenPlayerController.m | ||
| 3 | +// LiveVideoCloud | ||
| 4 | +// | ||
| 5 | +// Created by iOS on 17/3/14. | ||
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "LVCFullScreenPlayerController.h" | ||
| 10 | + | ||
| 11 | +@interface LVCFullScreenPlayerController () | ||
| 12 | + | ||
| 13 | +@end | ||
| 14 | + | ||
| 15 | +@implementation LVCFullScreenPlayerController | ||
| 16 | + | ||
| 17 | +- (UIInterfaceOrientationMask)supportedInterfaceOrientations { | ||
| 18 | + return UIInterfaceOrientationMaskLandscape; | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +- (BOOL)shouldAutorotate { | ||
| 22 | + return YES; | ||
| 23 | +} | ||
| 24 | + | ||
| 25 | +- (void)viewWillAppear:(BOOL)animated | ||
| 26 | +{ | ||
| 27 | + [super viewWillAppear:animated]; | ||
| 28 | + | ||
| 29 | + [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; | ||
| 30 | + [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade]; | ||
| 31 | +} | ||
| 32 | + | ||
| 33 | +- (void)viewDidLoad { | ||
| 34 | + [super viewDidLoad]; | ||
| 35 | + self.view.backgroundColor = [UIColor blackColor]; | ||
| 36 | + | ||
| 37 | +} | ||
| 38 | + | ||
| 39 | +- (void)didReceiveMemoryWarning { | ||
| 40 | + [super didReceiveMemoryWarning]; | ||
| 41 | + // Dispose of any resources that can be recreated. | ||
| 42 | +} | ||
| 43 | + | ||
| 44 | +/* | ||
| 45 | +#pragma mark - Navigation | ||
| 46 | + | ||
| 47 | +// In a storyboard-based application, you will often want to do a little preparation before navigation | ||
| 48 | +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { | ||
| 49 | + // Get the new view controller using [segue destinationViewController]. | ||
| 50 | + // Pass the selected object to the new view controller. | ||
| 51 | +} | ||
| 52 | +*/ | ||
| 53 | + | ||
| 54 | +@end |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Controller/LVCLivePlayerController.m
| @@ -8,28 +8,50 @@ | @@ -8,28 +8,50 @@ | ||
| 8 | 8 | ||
| 9 | #import "LVCLivePlayerController.h" | 9 | #import "LVCLivePlayerController.h" |
| 10 | #import "LVCPlayer.h" | 10 | #import "LVCPlayer.h" |
| 11 | +#import "LVCFullScreenPlayerController.h" | ||
| 12 | + | ||
| 13 | +#define WIDTH_SCREEN [UIScreen mainScreen].bounds.size.width | ||
| 14 | +#define HEIGHT_SCREEN [UIScreen mainScreen].bounds.size.height | ||
| 11 | 15 | ||
| 12 | @interface LVCLivePlayerController ()<LVCPlayerDelegate> | 16 | @interface LVCLivePlayerController ()<LVCPlayerDelegate> |
| 13 | { | 17 | { |
| 14 | - BOOL isHiddenStatusBar;//记录状态的隐藏显示 | ||
| 15 | - CGRect playerFrame; | 18 | + BOOL isHiddenStatusBar; //记录状态的隐藏显示 |
| 19 | + CGRect playerFrame; // | ||
| 20 | + NSInteger _originalDirection; //记录原始方向 | ||
| 16 | 21 | ||
| 17 | 22 | ||
| 18 | } | 23 | } |
| 19 | @property (nonatomic, strong) LVCPlayer *player; | 24 | @property (nonatomic, strong) LVCPlayer *player; |
| 25 | +@property (nonatomic, strong) LVCFullScreenPlayerController *fullVC; | ||
| 20 | 26 | ||
| 21 | @end | 27 | @end |
| 22 | 28 | ||
| 23 | @implementation LVCLivePlayerController | 29 | @implementation LVCLivePlayerController |
| 24 | 30 | ||
| 31 | +- (void)viewWillAppear:(BOOL)animated | ||
| 32 | +{ | ||
| 33 | + [super viewWillAppear:animated]; | ||
| 34 | + [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; | ||
| 35 | +} | ||
| 36 | + | ||
| 37 | +- (void)viewWillDisappear:(BOOL)animated | ||
| 38 | +{ | ||
| 39 | + [super viewWillDisappear:animated]; | ||
| 40 | + [[UIApplication sharedApplication] setStatusBarHidden: NO withAnimation:UIStatusBarAnimationNone]; | ||
| 41 | + [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault]; | ||
| 42 | +} | ||
| 43 | + | ||
| 25 | - (void)viewDidLoad { | 44 | - (void)viewDidLoad { |
| 26 | [super viewDidLoad]; | 45 | [super viewDidLoad]; |
| 27 | 46 | ||
| 47 | + self.view.backgroundColor = [UIColor whiteColor]; | ||
| 48 | + | ||
| 49 | + playerFrame = CGRectMake(0, 0,WIDTH_SCREEN, WIDTH_SCREEN*9/16); | ||
| 50 | + _originalDirection = 0; | ||
| 51 | + | ||
| 52 | + //注册通知 | ||
| 28 | [self addObservers]; | 53 | [self addObservers]; |
| 29 | 54 | ||
| 30 | - playerFrame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, ([UIScreen mainScreen].bounds.size.width)* 9 / 16); | ||
| 31 | - | ||
| 32 | - self.view.backgroundColor = [UIColor whiteColor]; | ||
| 33 | [self.view addSubview:self.player]; | 55 | [self.view addSubview:self.player]; |
| 34 | 56 | ||
| 35 | [self makeConstraints]; | 57 | [self makeConstraints]; |
| @@ -42,93 +64,84 @@ | @@ -42,93 +64,84 @@ | ||
| 42 | name:UIDeviceOrientationDidChangeNotification | 64 | name:UIDeviceOrientationDidChangeNotification |
| 43 | object:nil]; | 65 | object:nil]; |
| 44 | 66 | ||
| 67 | + | ||
| 45 | } | 68 | } |
| 46 | 69 | ||
| 47 | #pragma mark - | 70 | #pragma mark - |
| 48 | #pragma mark - Notification | 71 | #pragma mark - Notification |
| 49 | -- (void)onDeviceOrientationChange:(NSNotification *)notification{ | ||
| 50 | - | ||
| 51 | - if (_player==nil||_player.superview==nil){ | ||
| 52 | - return; | ||
| 53 | - } | 72 | +- (void)onDeviceOrientationChange:(NSNotification *)notification |
| 73 | +{ | ||
| 74 | + if (_player == nil|| _player.superview == nil) return; | ||
| 54 | 75 | ||
| 55 | - UIDeviceOrientation orientation = [UIDevice currentDevice].orientation; | ||
| 56 | - UIInterfaceOrientation interfaceOrientation = (UIInterfaceOrientation)orientation; | ||
| 57 | - switch (interfaceOrientation) { | ||
| 58 | - case UIInterfaceOrientationPortraitUpsideDown:{ | ||
| 59 | - _player.isFullScreen = NO; | ||
| 60 | - } | ||
| 61 | - break; | ||
| 62 | - case UIInterfaceOrientationPortrait:{ | ||
| 63 | - [self toOrientation:UIInterfaceOrientationPortrait]; | 76 | + UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation]; |
| 77 | + | ||
| 78 | + switch (orientation) { | ||
| 79 | + case UIDeviceOrientationPortrait: | ||
| 80 | + { | ||
| 81 | + if (_originalDirection == 1) { | ||
| 82 | + [self toHalfScreenWithrotationAngle:M_PI_2]; | ||
| 83 | + } else if (_originalDirection == 2){ | ||
| 84 | + [self toHalfScreenWithrotationAngle:-M_PI_2]; | ||
| 85 | + } | ||
| 86 | + _originalDirection = 0; | ||
| 64 | _player.isFullScreen = NO; | 87 | _player.isFullScreen = NO; |
| 65 | } | 88 | } |
| 66 | break; | 89 | break; |
| 67 | - case UIInterfaceOrientationLandscapeLeft:{ | ||
| 68 | - [self toOrientation:UIInterfaceOrientationLandscapeLeft]; | ||
| 69 | - _player.isFullScreen = YES; | 90 | + |
| 91 | + case UIDeviceOrientationLandscapeLeft: | ||
| 92 | + { | ||
| 93 | + if (_originalDirection == 0 ) { | ||
| 94 | + [self toFullWithrotationAngle:-M_PI_2]; | ||
| 95 | + } | ||
| 96 | + _originalDirection = 1; | ||
| 70 | } | 97 | } |
| 71 | break; | 98 | break; |
| 72 | - case UIInterfaceOrientationLandscapeRight:{ | ||
| 73 | - [self toOrientation:UIInterfaceOrientationLandscapeRight]; | ||
| 74 | - _player.isFullScreen = YES; | 99 | + |
| 100 | + case UIDeviceOrientationLandscapeRight: | ||
| 101 | + { | ||
| 102 | + if (_originalDirection == 0 ) { | ||
| 103 | + [self toFullWithrotationAngle:M_PI_2]; | ||
| 104 | + } | ||
| 105 | + _originalDirection = 2; | ||
| 75 | } | 106 | } |
| 76 | break; | 107 | break; |
| 108 | + | ||
| 77 | default: | 109 | default: |
| 78 | break; | 110 | break; |
| 79 | } | 111 | } |
| 80 | } | 112 | } |
| 81 | 113 | ||
| 82 | -#pragma mark - | ||
| 83 | -#pragma mark - 屏幕旋转 | ||
| 84 | --(void)toOrientation:(UIInterfaceOrientation)orientation{ | ||
| 85 | - //获取到当前状态条的方向 | ||
| 86 | - UIInterfaceOrientation currentOrientation = [UIApplication sharedApplication].statusBarOrientation; | ||
| 87 | - //判断如果当前方向和要旋转的方向一致,那么不做任何操作 | ||
| 88 | - if (currentOrientation == orientation) { | ||
| 89 | - return; | ||
| 90 | - } | 114 | +//旋转至全屏 |
| 115 | +- (void)toFullWithrotationAngle:(CGFloat)angle | ||
| 116 | +{ | ||
| 117 | + if (self.player.isFullScreen) return; | ||
| 91 | 118 | ||
| 92 | - //根据要旋转的方向,使用Masonry重新修改限制 | ||
| 93 | - if (orientation ==UIInterfaceOrientationPortrait) {// | ||
| 94 | - [_player mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 95 | - make.top.left.right.mas_equalTo(0); | ||
| 96 | - make.height.equalTo(@(playerFrame.size.height)); | 119 | + [self presentViewController:self.fullVC animated:NO completion:^{ |
| 120 | + [_player removeFromSuperview]; | ||
| 121 | + [self.fullVC.view addSubview:self.player]; | ||
| 122 | + [self makePlayerViewConstraints:YES]; | ||
| 123 | + self.player.transform = CGAffineTransformMakeRotation(angle); | ||
| 124 | + [UIView animateWithDuration:0.3 animations:^{ | ||
| 125 | + self.player.transform = CGAffineTransformMakeRotation(0); | ||
| 97 | }]; | 126 | }]; |
| 98 | - }else{ | ||
| 99 | - | ||
| 100 | - if (currentOrientation ==UIInterfaceOrientationPortrait) { | ||
| 101 | - [_player mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 102 | - make.width.equalTo(@([UIScreen mainScreen].bounds.size.height)); | ||
| 103 | - make.height.equalTo(@([UIScreen mainScreen].bounds.size.width)); | ||
| 104 | - make.center.equalTo(_player.superview); | ||
| 105 | - }]; | ||
| 106 | - } | ||
| 107 | - } | 127 | + }]; |
| 108 | 128 | ||
| 109 | - //设置状态栏方向 | ||
| 110 | - [[UIApplication sharedApplication] setStatusBarOrientation:orientation animated:NO]; | 129 | + self.player.isFullScreen = YES; |
| 111 | 130 | ||
| 112 | - //旋转屏幕 | ||
| 113 | - [UIView beginAnimations:nil context:nil]; | ||
| 114 | - _player.transform = CGAffineTransformIdentity; | ||
| 115 | - _player.transform = [self getCurrentDeviceOrientation]; | ||
| 116 | - [UIView setAnimationDuration:2.0]; | ||
| 117 | - [UIView commitAnimations]; | ||
| 118 | -} | ||
| 119 | - | ||
| 120 | -//获取旋转方向 | ||
| 121 | -- (CGAffineTransform)getCurrentDeviceOrientation{ | ||
| 122 | - UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation; | ||
| 123 | - //根据要进行旋转的方向来计算旋转的角度 | ||
| 124 | - if (orientation ==UIInterfaceOrientationPortrait) { | ||
| 125 | - return CGAffineTransformIdentity; | ||
| 126 | - }else if (orientation ==UIInterfaceOrientationLandscapeLeft){ | ||
| 127 | - return CGAffineTransformMakeRotation(-M_PI_2); | ||
| 128 | - }else if(orientation ==UIInterfaceOrientationLandscapeRight){ | ||
| 129 | - return CGAffineTransformMakeRotation(M_PI_2); | ||
| 130 | - } | ||
| 131 | - return CGAffineTransformIdentity; | 131 | +} |
| 132 | + | ||
| 133 | +//旋转至半屏 | ||
| 134 | +- (void)toHalfScreenWithrotationAngle:(CGFloat)angle | ||
| 135 | +{ | ||
| 136 | + [_fullVC dismissViewControllerAnimated:NO completion:^{ | ||
| 137 | + [_player removeFromSuperview]; | ||
| 138 | + [self.view addSubview:self.player]; | ||
| 139 | + [self makePlayerViewConstraints:NO]; | ||
| 140 | + self.player.transform = CGAffineTransformMakeRotation(angle); | ||
| 141 | + [UIView animateWithDuration:0.3 animations:^{ | ||
| 142 | + self.player.transform = CGAffineTransformMakeRotation(0); | ||
| 143 | + }]; | ||
| 144 | + }]; | ||
| 132 | } | 145 | } |
| 133 | 146 | ||
| 134 | #pragma mark - | 147 | #pragma mark - |
| @@ -136,32 +149,32 @@ | @@ -136,32 +149,32 @@ | ||
| 136 | - (void)lvcPlayer:(LVCPlayer *)player clickedBackBtn:(UIButton *)backBtn | 149 | - (void)lvcPlayer:(LVCPlayer *)player clickedBackBtn:(UIButton *)backBtn |
| 137 | { | 150 | { |
| 138 | //如果是全屏返回半屏,如果是半屏直接退出 | 151 | //如果是全屏返回半屏,如果是半屏直接退出 |
| 139 | - if (player.isFullScreen) { | ||
| 140 | - [self toOrientation:UIInterfaceOrientationPortrait]; | ||
| 141 | - player.isFullScreen = NO; | 152 | + if (self.player.isFullScreen) { |
| 153 | + [self toHalfScreenWithrotationAngle:M_PI_2]; | ||
| 154 | + self.player.isFullScreen = NO; | ||
| 142 | } else { | 155 | } else { |
| 156 | + [_player stopPlaying]; | ||
| 143 | self.navigationController.navigationBar.hidden = NO; | 157 | self.navigationController.navigationBar.hidden = NO; |
| 144 | [self.navigationController popViewControllerAnimated:YES]; | 158 | [self.navigationController popViewControllerAnimated:YES]; |
| 145 | } | 159 | } |
| 146 | } | 160 | } |
| 147 | 161 | ||
| 148 | -- (void)lvcPlayer:(LVCPlayer *)player clickedPlayOrPauseBtn:(UIButton *)playOrPauseBtn | ||
| 149 | -{ | ||
| 150 | - | ||
| 151 | -} | ||
| 152 | - | ||
| 153 | - (void)lvcPlayer:(LVCPlayer *)player clickedFullScreenBtn:(UIButton *)fullScreenBtn | 162 | - (void)lvcPlayer:(LVCPlayer *)player clickedFullScreenBtn:(UIButton *)fullScreenBtn |
| 154 | { | 163 | { |
| 155 | - if (player.isFullScreen == YES) {//全屏 | ||
| 156 | - [self toOrientation:UIInterfaceOrientationPortrait]; | ||
| 157 | - player.isFullScreen = NO; | 164 | + if (self.player.isFullScreen == YES) {//全屏 |
| 165 | + [self toHalfScreenWithrotationAngle:M_PI_2]; | ||
| 166 | + self.player.isFullScreen = NO; | ||
| 158 | 167 | ||
| 159 | }else{//非全屏 | 168 | }else{//非全屏 |
| 160 | - [self toOrientation:UIInterfaceOrientationLandscapeRight]; | ||
| 161 | - player.isFullScreen = YES; | 169 | + [self toFullWithrotationAngle:-M_PI_2]; |
| 162 | } | 170 | } |
| 163 | } | 171 | } |
| 164 | 172 | ||
| 173 | +- (void)lvcPlayer:(LVCPlayer *)player clickedEditBtn:(UIButton *)editBtn | ||
| 174 | +{ | ||
| 175 | + NSLog(@"开始编辑~~~~"); | ||
| 176 | +} | ||
| 177 | + | ||
| 165 | #pragma mark - | 178 | #pragma mark - |
| 166 | #pragma mark - makeConstraints | 179 | #pragma mark - makeConstraints |
| 167 | - (void)makeConstraints | 180 | - (void)makeConstraints |
| @@ -172,6 +185,21 @@ | @@ -172,6 +185,21 @@ | ||
| 172 | }]; | 185 | }]; |
| 173 | } | 186 | } |
| 174 | 187 | ||
| 188 | +- (void)makePlayerViewConstraints:(BOOL)fullScreen | ||
| 189 | +{ | ||
| 190 | + if (fullScreen) { | ||
| 191 | + [self.player mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 192 | + make.top.left.right.bottom.mas_equalTo(0); | ||
| 193 | + }]; | ||
| 194 | + | ||
| 195 | + } else { | ||
| 196 | + [self.player mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 197 | + make.top.left.right.mas_equalTo(0); | ||
| 198 | + make.height.equalTo(@(playerFrame.size.height)); | ||
| 199 | + }]; | ||
| 200 | + } | ||
| 201 | +} | ||
| 202 | + | ||
| 175 | #pragma mark - | 203 | #pragma mark - |
| 176 | #pragma mark - gatter | 204 | #pragma mark - gatter |
| 177 | - (LVCPlayer *)player | 205 | - (LVCPlayer *)player |
| @@ -183,6 +211,13 @@ | @@ -183,6 +211,13 @@ | ||
| 183 | return _player; | 211 | return _player; |
| 184 | } | 212 | } |
| 185 | 213 | ||
| 214 | +- (LVCFullScreenPlayerController *)fullVC | ||
| 215 | +{ | ||
| 216 | + if (!_fullVC) { | ||
| 217 | + _fullVC = [[LVCFullScreenPlayerController alloc] init]; | ||
| 218 | + } | ||
| 219 | + return _fullVC; | ||
| 220 | +} | ||
| 186 | - (void)didReceiveMemoryWarning { | 221 | - (void)didReceiveMemoryWarning { |
| 187 | [super didReceiveMemoryWarning]; | 222 | [super didReceiveMemoryWarning]; |
| 188 | // Dispose of any resources that can be recreated. | 223 | // Dispose of any resources that can be recreated. |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/View/LVCPlayer.h
| @@ -15,8 +15,8 @@ | @@ -15,8 +15,8 @@ | ||
| 15 | @optional | 15 | @optional |
| 16 | 16 | ||
| 17 | - (void)lvcPlayer:(LVCPlayer *)player clickedBackBtn:(UIButton *)backBtn; //返回 | 17 | - (void)lvcPlayer:(LVCPlayer *)player clickedBackBtn:(UIButton *)backBtn; //返回 |
| 18 | -- (void)lvcPlayer:(LVCPlayer *)player clickedPlayOrPauseBtn:(UIButton *)playOrPauseBtn; //播放或暂停 | ||
| 19 | - (void)lvcPlayer:(LVCPlayer *)player clickedFullScreenBtn:(UIButton *)fullScreenBtn; //全屏 | 18 | - (void)lvcPlayer:(LVCPlayer *)player clickedFullScreenBtn:(UIButton *)fullScreenBtn; //全屏 |
| 19 | +- (void)lvcPlayer:(LVCPlayer *)player clickedEditBtn:(UIButton *)editBtn; //全屏编辑按钮 | ||
| 20 | 20 | ||
| 21 | @end | 21 | @end |
| 22 | 22 | ||
| @@ -25,9 +25,10 @@ | @@ -25,9 +25,10 @@ | ||
| 25 | 25 | ||
| 26 | @property (nonatomic, assign) id<LVCPlayerDelegate> delegate; | 26 | @property (nonatomic, assign) id<LVCPlayerDelegate> delegate; |
| 27 | 27 | ||
| 28 | -@property (nonatomic, strong) UIView *contentView; //所有空间统一管理在这个view中 | 28 | +@property (nonatomic, strong) UIImageView *contentView; //所有空间统一管理在这个view中 |
| 29 | @property (nonatomic, strong) UIButton *backBtn; //返回 | 29 | @property (nonatomic, strong) UIButton *backBtn; //返回 |
| 30 | +@property (nonatomic, assign) BOOL isFullScreen; //是否是全屏 | ||
| 30 | 31 | ||
| 31 | -@property (nonatomic, assign) BOOL isFullScreen; //是否是全屏 | 32 | +- (void)stopPlaying; |
| 32 | 33 | ||
| 33 | @end | 34 | @end |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/View/LVCPlayer.m
| @@ -7,16 +7,27 @@ | @@ -7,16 +7,27 @@ | ||
| 7 | // | 7 | // |
| 8 | 8 | ||
| 9 | #import "LVCPlayer.h" | 9 | #import "LVCPlayer.h" |
| 10 | +#import "LVCPlayerLoadingView.h" | ||
| 11 | +#import "SevenSwitch.h" | ||
| 10 | 12 | ||
| 11 | -@interface LVCPlayer () | 13 | +#define kAppId @"60_irn9edco29" |
| 14 | +#define kAppKey @"69fe70bda67e059286ad509d9f5377f815955645b52f94" | ||
| 15 | +#define kbundleId @"com.cnlive.zhangxu.LiveVideoCloud" | ||
| 12 | 16 | ||
| 17 | +@interface LVCPlayer () | ||
| 18 | +{ | ||
| 19 | + BOOL _isFull; | ||
| 20 | +} | ||
| 13 | @property (nonatomic, strong) UIImageView *topBgView; //顶部蒙版 | 21 | @property (nonatomic, strong) UIImageView *topBgView; //顶部蒙版 |
| 14 | @property (nonatomic, strong) UIImageView *bottomBgView; //底部蒙版 | 22 | @property (nonatomic, strong) UIImageView *bottomBgView; //底部蒙版 |
| 15 | @property (nonatomic, strong) UIButton *playOrPauseBtn; //播放/暂停 | 23 | @property (nonatomic, strong) UIButton *playOrPauseBtn; //播放/暂停 |
| 16 | @property (nonatomic, strong) UILabel *titleLab; //标题 | 24 | @property (nonatomic, strong) UILabel *titleLab; //标题 |
| 17 | @property (nonatomic, strong) UIButton *fullScreenBtn; //控制全屏按钮 | 25 | @property (nonatomic, strong) UIButton *fullScreenBtn; //控制全屏按钮 |
| 18 | -@property (nonatomic, strong) UIGestureRecognizer *singleTap; //单击手势 | ||
| 19 | -@property (nonatomic, strong) UIActivityIndicatorView *loadingView; //加载图 | 26 | +@property (nonatomic, strong) UITapGestureRecognizer *singleTap; //单击手势 |
| 27 | +@property (nonatomic, strong) LVCPlayerLoadingView *loadingView; //加载图 | ||
| 28 | +@property (nonatomic, strong) CNLiveMoviePlayerController *player; | ||
| 29 | +@property (nonatomic, strong) SevenSwitch *barrageSwitch; //弹幕开关 | ||
| 30 | +@property (nonatomic, strong) UIButton *editBtn; //全屏编辑按钮 | ||
| 20 | @end | 31 | @end |
| 21 | 32 | ||
| 22 | @implementation LVCPlayer | 33 | @implementation LVCPlayer |
| @@ -26,27 +37,62 @@ | @@ -26,27 +37,62 @@ | ||
| 26 | self = [super initWithFrame:frame]; | 37 | self = [super initWithFrame:frame]; |
| 27 | if (self) { | 38 | if (self) { |
| 28 | 39 | ||
| 40 | + [self initPlayer]; | ||
| 41 | + | ||
| 29 | [self addSubview:self.contentView]; | 42 | [self addSubview:self.contentView]; |
| 30 | [self.contentView addSubview:self.bottomBgView]; | 43 | [self.contentView addSubview:self.bottomBgView]; |
| 31 | [self.contentView addSubview:self.topBgView]; | 44 | [self.contentView addSubview:self.topBgView]; |
| 32 | [self.bottomBgView addSubview:self.playOrPauseBtn]; | 45 | [self.bottomBgView addSubview:self.playOrPauseBtn]; |
| 33 | [self.bottomBgView addSubview:self.fullScreenBtn]; | 46 | [self.bottomBgView addSubview:self.fullScreenBtn]; |
| 34 | [self.topBgView addSubview:self.titleLab]; | 47 | [self.topBgView addSubview:self.titleLab]; |
| 35 | - [self.topBgView addSubview:self.backBtn]; | 48 | + [self.topBgView addSubview:self.barrageSwitch]; |
| 49 | + [self addSubview:self.backBtn]; | ||
| 36 | [self.contentView addSubview:self.loadingView]; | 50 | [self.contentView addSubview:self.loadingView]; |
| 51 | + [self.contentView addSubview:self.editBtn]; | ||
| 52 | + [self.contentView addGestureRecognizer:self.singleTap]; | ||
| 53 | + | ||
| 37 | [self makeSubViewsConstraints]; | 54 | [self makeSubViewsConstraints]; |
| 38 | 55 | ||
| 39 | } | 56 | } |
| 40 | return self; | 57 | return self; |
| 41 | } | 58 | } |
| 59 | +#pragma mark - | ||
| 60 | +#pragma mark - initPlayer | ||
| 61 | +- (void)initPlayer | ||
| 62 | +{ | ||
| 63 | + [[CNLiveWebcastManager manager] initWithAppId:kAppId appKey:kAppKey]; | ||
| 64 | + //点播播放 | ||
| 65 | + _player = [[CNLiveMoviePlayerController alloc] initVodPlayWithVId:@"aaa123" | ||
| 66 | + authSuccess:^{ | ||
| 67 | + | ||
| 68 | + [self addObservers]; | ||
| 69 | + _player.videoDecoderMode = CNLiveMovieVideoDecoderMode_AUTO; | ||
| 70 | + _player.shouldAutoplay = YES; | ||
| 71 | + [_player prepareToPlay]; | ||
| 72 | + [self.contentView addSubview:_player.view]; | ||
| 73 | + [self.contentView sendSubviewToBack:_player.view]; | ||
| 74 | + | ||
| 75 | + [self makePlayerConstraint]; | ||
| 76 | + | ||
| 77 | + | ||
| 78 | + } authFailed:^(NSDictionary *errorInfo) { | ||
| 79 | + NSLog(@"初始化点播播放器失败%@", errorInfo); | ||
| 80 | + | ||
| 81 | + }]; | ||
| 82 | +} | ||
| 42 | 83 | ||
| 43 | #pragma mark - | 84 | #pragma mark - |
| 44 | #pragma mark - action | 85 | #pragma mark - action |
| 45 | - (void)playOrPauseBtnAction:(UIButton *)btn | 86 | - (void)playOrPauseBtnAction:(UIButton *)btn |
| 46 | { | 87 | { |
| 47 | - if (self.delegate && [self.delegate respondsToSelector:@selector(lvcPlayer:clickedPlayOrPauseBtn:)]) { | ||
| 48 | - [self.delegate lvcPlayer:self clickedPlayOrPauseBtn:btn]; | 88 | + if (btn.selected) { |
| 89 | + [_player pause]; | ||
| 90 | + } else { | ||
| 91 | + [_player play]; | ||
| 49 | } | 92 | } |
| 93 | + | ||
| 94 | + btn.selected =! btn.selected; | ||
| 95 | + | ||
| 50 | } | 96 | } |
| 51 | 97 | ||
| 52 | - (void)backBtnAction:(UIButton *)btn | 98 | - (void)backBtnAction:(UIButton *)btn |
| @@ -64,24 +110,238 @@ | @@ -64,24 +110,238 @@ | ||
| 64 | 110 | ||
| 65 | } | 111 | } |
| 66 | 112 | ||
| 113 | +- (void)singleTapView | ||
| 114 | +{ | ||
| 115 | + [UIView animateWithDuration:0.25 animations:^{ | ||
| 116 | + self.topBgView.alpha = self.topBgView.alpha == 0 ? 1 : 0; | ||
| 117 | + self.bottomBgView.alpha = self.bottomBgView.alpha == 0 ? 1 : 0; | ||
| 118 | + self.editBtn.alpha = self.editBtn.alpha == 0 ? 1 : 0; | ||
| 119 | + }]; | ||
| 120 | + [[UIApplication sharedApplication] setStatusBarHidden:self.topBgView.alpha == 0 ? YES : NO withAnimation:UIStatusBarAnimationFade]; | ||
| 121 | + | ||
| 122 | +} | ||
| 123 | + | ||
| 124 | +- (void)barrageSwitchAction | ||
| 125 | +{ | ||
| 126 | + NSString *string = self.barrageSwitch.on ? @"已开启弹幕" : @"已关闭弹幕"; | ||
| 127 | + | ||
| 128 | + NSLog(@"%@",string); | ||
| 129 | +} | ||
| 130 | + | ||
| 131 | +- (void)editBtnAction:(UIButton *)btn | ||
| 132 | +{ | ||
| 133 | + if (self.delegate && [self.delegate respondsToSelector:@selector(lvcPlayer:clickedEditBtn:)]) { | ||
| 134 | + [self.delegate lvcPlayer:self clickedEditBtn:btn]; | ||
| 135 | + } | ||
| 136 | +} | ||
| 137 | + | ||
| 67 | #pragma mark - | 138 | #pragma mark - |
| 68 | -#pragma mark - setter | 139 | +#pragma mark - Notification |
| 140 | +- (void)addObservers | ||
| 141 | +{ | ||
| 142 | + //视频加载状态改变 | ||
| 143 | + [[NSNotificationCenter defaultCenter] addObserver:self | ||
| 144 | + selector:@selector(loadStateDidChange:) | ||
| 145 | + name:MPMoviePlayerLoadStateDidChangeNotification | ||
| 146 | + object:nil]; | ||
| 147 | + | ||
| 148 | + //视频播放错误及结束原因 | ||
| 149 | + [[NSNotificationCenter defaultCenter] addObserver:self | ||
| 150 | + selector:@selector(moviePlayBackDidFinish:) | ||
| 151 | + name:MPMoviePlayerPlaybackDidFinishNotification | ||
| 152 | + object:nil]; | ||
| 153 | + | ||
| 154 | + //视频缓冲至可播放状态 | ||
| 155 | + [[NSNotificationCenter defaultCenter] addObserver:self | ||
| 156 | + selector:@selector(mediaIsPreparedToPlayDidChange:) | ||
| 157 | + name:MPMediaPlaybackIsPreparedToPlayDidChangeNotification | ||
| 158 | + object:nil]; | ||
| 159 | + | ||
| 160 | + //视频播放状态改变 | ||
| 161 | + [[NSNotificationCenter defaultCenter] addObserver:self | ||
| 162 | + selector:@selector(moviePlayBackStateDidChange:) | ||
| 163 | + name:MPMoviePlayerPlaybackStateDidChangeNotification | ||
| 164 | + object:nil]; | ||
| 165 | + | ||
| 166 | + [[NSNotificationCenter defaultCenter] addObserver:self | ||
| 167 | + selector:@selector(appResignActive:) | ||
| 168 | + name:UIApplicationWillResignActiveNotification | ||
| 169 | + object:nil]; | ||
| 170 | + | ||
| 171 | + [[NSNotificationCenter defaultCenter] addObserver:self | ||
| 172 | + selector:@selector(appBecomeActive:) | ||
| 173 | + name:UIApplicationDidBecomeActiveNotification | ||
| 174 | + object:nil]; | ||
| 175 | +} | ||
| 176 | + | ||
| 177 | +- (void)loadStateDidChange:(NSNotification *)notification | ||
| 178 | +{ | ||
| 179 | + if (_player) { | ||
| 180 | + MPMovieLoadState loadState = _player.loadState; | ||
| 181 | + if ((loadState & MPMovieLoadStatePlaythroughOK) != 0) { | ||
| 182 | + NSLog(@"loadStateDidChange: MPMovieLoadStatePlaythroughOK: %d\n", (int)loadState); | ||
| 183 | + | ||
| 184 | + } else if ((loadState & MPMovieLoadStateStalled) != 0) { | ||
| 185 | + NSLog(@"loadStateDidChange: MPMovieLoadStateStalled: %d\n", (int)loadState); | ||
| 186 | + | ||
| 187 | + } else { | ||
| 188 | + NSLog(@"loadStateDidChange: ???: %d\n", (int)loadState); | ||
| 189 | + } | ||
| 190 | + } | ||
| 191 | +} | ||
| 192 | + | ||
| 193 | +- (void)moviePlayBackDidFinish:(NSNotification *)notification | ||
| 194 | +{ | ||
| 195 | + if (_player) { | ||
| 196 | + int reason = [[[notification userInfo] valueForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey] intValue]; | ||
| 197 | + if (MPMovieFinishReasonPlaybackError == reason) { | ||
| 198 | + } else { | ||
| 199 | +// _loadingView.retryBtn.hidden = YES; | ||
| 200 | + } | ||
| 201 | + | ||
| 202 | + switch (reason) | ||
| 203 | + { | ||
| 204 | + case MPMovieFinishReasonPlaybackEnded: | ||
| 205 | + NSLog(@"playbackStateDidChange: MPMovieFinishReasonPlaybackEnded: %d\n", reason); | ||
| 206 | + break; | ||
| 207 | + | ||
| 208 | + case MPMovieFinishReasonUserExited: | ||
| 209 | + NSLog(@"playbackStateDidChange: MPMovieFinishReasonUserExited: %d\n", reason); | ||
| 210 | + break; | ||
| 211 | + | ||
| 212 | + case MPMovieFinishReasonPlaybackError: | ||
| 213 | + NSLog(@"playbackStateDidChange: MPMovieFinishReasonPlaybackError: %d\n", reason); | ||
| 214 | + break; | ||
| 215 | + | ||
| 216 | + default: | ||
| 217 | + NSLog(@"playbackPlayBackDidFinish: ???: %d\n", reason); | ||
| 218 | + break; | ||
| 219 | + } | ||
| 220 | + } | ||
| 221 | +} | ||
| 222 | + | ||
| 223 | +- (void)mediaIsPreparedToPlayDidChange:(NSNotification *)notification | ||
| 224 | +{ | ||
| 225 | + if (_player) { | ||
| 226 | + NSLog(@"isPreparedToPlay"); | ||
| 227 | + } | ||
| 228 | +} | ||
| 229 | + | ||
| 230 | +- (void)moviePlayBackStateDidChange:(NSNotification *)notification | ||
| 231 | +{ | ||
| 232 | + if (_player) { | ||
| 233 | + | ||
| 234 | + if (_player.playbackState == MPMoviePlaybackStatePlaying) { | ||
| 235 | + _playOrPauseBtn.selected = YES; | ||
| 236 | + [self.loadingView retry]; | ||
| 237 | + } else { | ||
| 238 | + _playOrPauseBtn.selected = NO; | ||
| 239 | + } | ||
| 240 | + | ||
| 241 | + NSLog(@"moviePlayBackStateDidChange : %ld",(long)_player.playbackState); | ||
| 242 | + | ||
| 243 | + /* | ||
| 244 | + switch (_player.playbackState) { | ||
| 245 | + case MPMoviePlaybackStateStopped: { | ||
| 246 | + | ||
| 247 | + [self changePlayBtnStatus:NO]; | ||
| 248 | + NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStateStopped"); | ||
| 249 | + break; | ||
| 250 | + } | ||
| 251 | + case MPMoviePlaybackStatePlaying: { | ||
| 252 | + [self changePlayBtnStatus:YES]; | ||
| 253 | + NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStatePlaying"); | ||
| 254 | + break; | ||
| 255 | + } | ||
| 256 | + case MPMoviePlaybackStatePaused: | ||
| 257 | + [self changePlayBtnStatus:NO]; | ||
| 258 | + NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStatePaused"); | ||
| 259 | + break; | ||
| 260 | + case MPMoviePlaybackStateInterrupted: | ||
| 261 | + [self changePlayBtnStatus:NO]; | ||
| 262 | + NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStateInterrupted"); | ||
| 263 | + break; | ||
| 264 | + case MPMoviePlaybackStateSeekingForward: | ||
| 265 | + [self changePlayBtnStatus:NO]; | ||
| 266 | + NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStateSeekingForward"); | ||
| 267 | + break; | ||
| 268 | + case MPMoviePlaybackStateSeekingBackward: | ||
| 269 | + [self changePlayBtnStatus:NO]; | ||
| 270 | + NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStateSeekingBackward"); | ||
| 271 | + break; | ||
| 272 | + default: | ||
| 273 | + [self changePlayBtnStatus:NO]; | ||
| 274 | + NSLog(@"moviePlayBackStateDidChange : %ld", _player.playbackState); | ||
| 275 | + break; | ||
| 276 | + } | ||
| 277 | + */ | ||
| 278 | + } | ||
| 279 | +} | ||
| 280 | + | ||
| 281 | +- (void)appResignActive:(NSNotification *)noti | ||
| 282 | +{ | ||
| 283 | + [_player pause]; | ||
| 284 | +} | ||
| 285 | + | ||
| 286 | +- (void)appBecomeActive:(NSNotification *)noti | ||
| 287 | +{ | ||
| 288 | + [_player play]; | ||
| 289 | +} | ||
| 69 | 290 | ||
| 291 | +#pragma mark - | ||
| 292 | +#pragma mark - public | ||
| 293 | +- (void)stopPlaying | ||
| 294 | +{ | ||
| 295 | + if (_player.isPlaying) { | ||
| 296 | + [_player stop]; | ||
| 297 | + } | ||
| 298 | + _player = nil; | ||
| 299 | + [self removeMovieNotificationObservers]; | ||
| 300 | +} | ||
| 301 | + | ||
| 302 | +- (void)removeMovieNotificationObservers | ||
| 303 | +{ | ||
| 304 | + [[NSNotificationCenter defaultCenter]removeObserver:self | ||
| 305 | + name:MPMoviePlayerLoadStateDidChangeNotification | ||
| 306 | + object:nil]; | ||
| 307 | + [[NSNotificationCenter defaultCenter]removeObserver:self | ||
| 308 | + name:MPMoviePlayerPlaybackDidFinishNotification | ||
| 309 | + object:nil]; | ||
| 310 | + [[NSNotificationCenter defaultCenter]removeObserver:self | ||
| 311 | + name:MPMediaPlaybackIsPreparedToPlayDidChangeNotification | ||
| 312 | + object:nil]; | ||
| 313 | + [[NSNotificationCenter defaultCenter]removeObserver:self | ||
| 314 | + name:MPMoviePlayerPlaybackStateDidChangeNotification | ||
| 315 | + object:nil]; | ||
| 316 | +} | ||
| 317 | + | ||
| 318 | +#pragma mark - | ||
| 319 | +#pragma mark - makeConstraints | ||
| 320 | +- (void)makePlayerConstraint | ||
| 321 | +{ | ||
| 322 | + [self.player.view mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 323 | + make.width.equalTo(self.contentView); | ||
| 324 | + make.height.equalTo(self.contentView); | ||
| 325 | + make.center.equalTo(self.contentView); | ||
| 326 | + }]; | ||
| 327 | +} | ||
| 70 | 328 | ||
| 71 | - (void)makeSubViewsConstraints | 329 | - (void)makeSubViewsConstraints |
| 72 | { | 330 | { |
| 331 | + | ||
| 73 | [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) { | 332 | [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) { |
| 74 | make.top.left.right.bottom.mas_equalTo(0); | 333 | make.top.left.right.bottom.mas_equalTo(0); |
| 75 | }]; | 334 | }]; |
| 76 | 335 | ||
| 77 | [self.loadingView mas_makeConstraints:^(MASConstraintMaker *make) { | 336 | [self.loadingView mas_makeConstraints:^(MASConstraintMaker *make) { |
| 78 | make.center.equalTo(self.contentView); | 337 | make.center.equalTo(self.contentView); |
| 338 | + make.width.mas_equalTo(100); | ||
| 339 | + make.height.mas_equalTo(80); | ||
| 79 | }]; | 340 | }]; |
| 80 | - | 341 | + |
| 81 | [self.backBtn mas_makeConstraints:^(MASConstraintMaker *make) { | 342 | [self.backBtn mas_makeConstraints:^(MASConstraintMaker *make) { |
| 82 | make.left.equalTo(self.topBgView).with.offset(5); | 343 | make.left.equalTo(self.topBgView).with.offset(5); |
| 83 | - make.height.mas_equalTo(30); | ||
| 84 | - make.width.mas_equalTo(30); | 344 | + make.width.height.mas_equalTo(30); |
| 85 | make.top.equalTo(self.topBgView).with.offset(20); | 345 | make.top.equalTo(self.topBgView).with.offset(20); |
| 86 | }]; | 346 | }]; |
| 87 | 347 | ||
| @@ -90,41 +350,55 @@ | @@ -90,41 +350,55 @@ | ||
| 90 | make.height.mas_equalTo(70); | 350 | make.height.mas_equalTo(70); |
| 91 | }]; | 351 | }]; |
| 92 | 352 | ||
| 353 | + [self.barrageSwitch mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 354 | + make.width.mas_equalTo(35); | ||
| 355 | + make.height.mas_equalTo(20); | ||
| 356 | + make.top.mas_equalTo(20); | ||
| 357 | + make.right.equalTo(self.topBgView).offset(-60); | ||
| 358 | + }]; | ||
| 359 | + | ||
| 93 | [self.bottomBgView mas_makeConstraints:^(MASConstraintMaker *make) { | 360 | [self.bottomBgView mas_makeConstraints:^(MASConstraintMaker *make) { |
| 94 | make.bottom.left.right.equalTo(self.contentView).with.offset(0); | 361 | make.bottom.left.right.equalTo(self.contentView).with.offset(0); |
| 95 | make.height.mas_equalTo(50); | 362 | make.height.mas_equalTo(50); |
| 96 | }]; | 363 | }]; |
| 97 | 364 | ||
| 98 | [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) { | 365 | [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) { |
| 99 | - make.leading.trailing.bottom.mas_equalTo(0); | ||
| 100 | - make.height.mas_equalTo(40); | 366 | + make.left.equalTo(self.backBtn).offset(40); |
| 367 | + make.top.trailing.bottom.mas_equalTo(0); | ||
| 101 | }]; | 368 | }]; |
| 102 | 369 | ||
| 103 | [self.playOrPauseBtn mas_makeConstraints:^(MASConstraintMaker *make) { | 370 | [self.playOrPauseBtn mas_makeConstraints:^(MASConstraintMaker *make) { |
| 104 | - make.left.equalTo(self.bottomBgView).with.offset(0); | ||
| 105 | - make.height.mas_equalTo(50); | ||
| 106 | - make.bottom.equalTo(self.bottomBgView).with.offset(0); | ||
| 107 | - make.width.mas_equalTo(50); | 371 | + make.left.bottom.equalTo(self.bottomBgView).with.offset(0); |
| 372 | + make.width.height.mas_equalTo(50); | ||
| 108 | }]; | 373 | }]; |
| 109 | 374 | ||
| 110 | [self.fullScreenBtn mas_makeConstraints:^(MASConstraintMaker *make) { | 375 | [self.fullScreenBtn mas_makeConstraints:^(MASConstraintMaker *make) { |
| 111 | - make.right.equalTo(self.bottomBgView).with.offset(0); | ||
| 112 | - make.height.mas_equalTo(50); | ||
| 113 | - make.bottom.equalTo(self.bottomBgView).with.offset(0); | ||
| 114 | - make.width.mas_equalTo(50); | ||
| 115 | - | 376 | + make.right.bottom.equalTo(self.bottomBgView).with.offset(0); |
| 377 | + make.width.height.mas_equalTo(50); | ||
| 378 | + }]; | ||
| 379 | + | ||
| 380 | + [self.editBtn mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 381 | + make.width.height.mas_equalTo(40); | ||
| 382 | + make.centerY.equalTo(self.contentView); | ||
| 383 | + make.right.equalTo(self.contentView).with.offset(-20); | ||
| 116 | }]; | 384 | }]; |
| 117 | 385 | ||
| 118 | } | 386 | } |
| 119 | 387 | ||
| 120 | #pragma mark - | 388 | #pragma mark - |
| 389 | +#pragma mark - setter | ||
| 390 | + | ||
| 391 | + | ||
| 392 | +#pragma mark - | ||
| 121 | #pragma mark - getter | 393 | #pragma mark - getter |
| 122 | 394 | ||
| 123 | -- (UIView *)contentView | 395 | +- (UIImageView *)contentView |
| 124 | { | 396 | { |
| 125 | if (!_contentView) { | 397 | if (!_contentView) { |
| 126 | - _contentView = [[UIView alloc] init]; | ||
| 127 | - _contentView.backgroundColor = [UIColor blueColor]; | 398 | + _contentView = [[UIImageView alloc] init]; |
| 399 | + _contentView.image = [UIImage imageNamed:@""]; | ||
| 400 | + _contentView.backgroundColor = [UIColor lightGrayColor]; | ||
| 401 | + _contentView.userInteractionEnabled = YES; | ||
| 128 | } | 402 | } |
| 129 | return _contentView; | 403 | return _contentView; |
| 130 | } | 404 | } |
| @@ -153,8 +427,8 @@ | @@ -153,8 +427,8 @@ | ||
| 153 | { | 427 | { |
| 154 | if (!_playOrPauseBtn) { | 428 | if (!_playOrPauseBtn) { |
| 155 | _playOrPauseBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | 429 | _playOrPauseBtn = [UIButton buttonWithType:UIButtonTypeCustom]; |
| 156 | - [_playOrPauseBtn setImage:[UIImage imageNamed:@"pause"] forState:UIControlStateNormal]; | ||
| 157 | - [_playOrPauseBtn setImage:[UIImage imageNamed:@"play"] forState:UIControlStateSelected]; | 430 | + [_playOrPauseBtn setImage:[UIImage imageNamed:@"play"] forState:UIControlStateNormal]; |
| 431 | + [_playOrPauseBtn setImage:[UIImage imageNamed:@"pause"] forState:UIControlStateSelected]; | ||
| 158 | [_playOrPauseBtn addTarget:self action:@selector(playOrPauseBtnAction:) forControlEvents:UIControlEventTouchUpInside]; | 432 | [_playOrPauseBtn addTarget:self action:@selector(playOrPauseBtnAction:) forControlEvents:UIControlEventTouchUpInside]; |
| 159 | } | 433 | } |
| 160 | return _playOrPauseBtn; | 434 | return _playOrPauseBtn; |
| @@ -164,8 +438,9 @@ | @@ -164,8 +438,9 @@ | ||
| 164 | { | 438 | { |
| 165 | if (!_titleLab) { | 439 | if (!_titleLab) { |
| 166 | _titleLab = [[UILabel alloc] init]; | 440 | _titleLab = [[UILabel alloc] init]; |
| 441 | + _titleLab.text = @"我是标题~~"; | ||
| 167 | _titleLab.textColor = [UIColor whiteColor]; | 442 | _titleLab.textColor = [UIColor whiteColor]; |
| 168 | - _titleLab.font = [UIFont systemFontOfSize:15]; | 443 | + _titleLab.font = [UIFont systemFontOfSize:17]; |
| 169 | } | 444 | } |
| 170 | return _titleLab; | 445 | return _titleLab; |
| 171 | } | 446 | } |
| @@ -185,21 +460,53 @@ | @@ -185,21 +460,53 @@ | ||
| 185 | { | 460 | { |
| 186 | if (!_backBtn) { | 461 | if (!_backBtn) { |
| 187 | _backBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | 462 | _backBtn = [UIButton buttonWithType:UIButtonTypeCustom]; |
| 188 | - [_backBtn setImage:[UIImage imageNamed:@"返回"] forState:UIControlStateNormal]; | 463 | + [_backBtn setImage:[UIImage imageNamed:@"play_back"] forState:UIControlStateNormal]; |
| 189 | [_backBtn addTarget:self action:@selector(backBtnAction:) forControlEvents:UIControlEventTouchUpInside]; | 464 | [_backBtn addTarget:self action:@selector(backBtnAction:) forControlEvents:UIControlEventTouchUpInside]; |
| 190 | } | 465 | } |
| 191 | return _backBtn; | 466 | return _backBtn; |
| 192 | } | 467 | } |
| 193 | 468 | ||
| 194 | -- (UIActivityIndicatorView *)loadingView | 469 | +- (LVCPlayerLoadingView *)loadingView |
| 195 | { | 470 | { |
| 196 | if (!_loadingView) { | 471 | if (!_loadingView) { |
| 197 | - _loadingView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; | ||
| 198 | - [_loadingView startAnimating]; | 472 | + _loadingView = [[LVCPlayerLoadingView alloc] init]; |
| 199 | } | 473 | } |
| 200 | return _loadingView; | 474 | return _loadingView; |
| 201 | } | 475 | } |
| 202 | 476 | ||
| 477 | +- (UITapGestureRecognizer *)singleTap | ||
| 478 | +{ | ||
| 479 | + if (!_singleTap) { | ||
| 480 | + _singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTapView)]; | ||
| 481 | + } | ||
| 482 | + return _singleTap; | ||
| 483 | +} | ||
| 484 | + | ||
| 485 | +- (SevenSwitch *)barrageSwitch { //弹幕开关 | ||
| 486 | + if (!_barrageSwitch) { | ||
| 487 | + _barrageSwitch = [[SevenSwitch alloc] init]; | ||
| 488 | + _barrageSwitch.knobOnImage = [UIImage imageNamed:@"弹off"]; | ||
| 489 | + _barrageSwitch.knobOffImage = [UIImage imageNamed:@"弹off"]; | ||
| 490 | + _barrageSwitch.onColor = [UIColor yellowColorZX]; | ||
| 491 | + _barrageSwitch.borderColor = [UIColor blackColor]; | ||
| 492 | + _barrageSwitch.activeColor = [UIColor blackColor]; | ||
| 493 | + _barrageSwitch.inactiveColor = [UIColor blackColor]; | ||
| 494 | + _barrageSwitch.on = YES; | ||
| 495 | +// _barrageSwitch.hidden = YES; | ||
| 496 | + [_barrageSwitch addTarget:self action:@selector(barrageSwitchAction) forControlEvents:UIControlEventValueChanged]; | ||
| 497 | + } | ||
| 498 | + return _barrageSwitch; | ||
| 499 | +} | ||
| 500 | + | ||
| 501 | +- (UIButton *)editBtn | ||
| 502 | +{ | ||
| 503 | + if (!_editBtn) { | ||
| 504 | + _editBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 505 | + [_editBtn setImage:[UIImage imageNamed:@"Barrage input"] forState:UIControlStateNormal]; | ||
| 506 | + [_editBtn addTarget:self action:@selector(editBtnAction:) forControlEvents:UIControlEventTouchUpInside]; | ||
| 507 | + } | ||
| 508 | + return _editBtn; | ||
| 509 | +} | ||
| 203 | 510 | ||
| 204 | /* | 511 | /* |
| 205 | // Only override drawRect: if you perform custom drawing. | 512 | // Only override drawRect: if you perform custom drawing. |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/View/LVCPlayerLoadingView.h
0 → 100644
| 1 | +// | ||
| 2 | +// LVCPlayerLoadingView.h | ||
| 3 | +// LiveVideoCloud | ||
| 4 | +// | ||
| 5 | +// Created by iOS on 17/3/15. | ||
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import <UIKit/UIKit.h> | ||
| 10 | + | ||
| 11 | +@protocol LVCPlayerLoadingViewDelegate <NSObject> | ||
| 12 | + | ||
| 13 | +- (void)retryBtnClick; //点击重试 | ||
| 14 | + | ||
| 15 | +@end | ||
| 16 | + | ||
| 17 | +@interface LVCPlayerLoadingView : UIView | ||
| 18 | + | ||
| 19 | +@property (nonatomic, assign) id<LVCPlayerLoadingViewDelegate> delegate; | ||
| 20 | + | ||
| 21 | +- (void)startLoading; //开始加载 | ||
| 22 | + | ||
| 23 | +- (void)stopLoading; //停止加载 | ||
| 24 | + | ||
| 25 | +- (void)retry; | ||
| 26 | + | ||
| 27 | +@end |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/View/LVCPlayerLoadingView.m
0 → 100644
| 1 | +// | ||
| 2 | +// LVCPlayerLoadingView.m | ||
| 3 | +// LiveVideoCloud | ||
| 4 | +// | ||
| 5 | +// Created by iOS on 17/3/15. | ||
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "LVCPlayerLoadingView.h" | ||
| 10 | + | ||
| 11 | +@interface LVCPlayerLoadingView () | ||
| 12 | + | ||
| 13 | +@property (nonatomic, strong) UIActivityIndicatorView *loadingView; | ||
| 14 | +@property (nonatomic, strong) UILabel *loadingLab; | ||
| 15 | +@property (nonatomic, strong) UIButton *retryBtn; | ||
| 16 | + | ||
| 17 | +@end | ||
| 18 | + | ||
| 19 | +@implementation LVCPlayerLoadingView | ||
| 20 | + | ||
| 21 | +- (instancetype)initWithFrame:(CGRect)frame | ||
| 22 | +{ | ||
| 23 | + self = [super initWithFrame:frame]; | ||
| 24 | + if (self) { | ||
| 25 | + [self addSubview:self.loadingView]; | ||
| 26 | + [self addSubview:self.loadingLab]; | ||
| 27 | + [self addSubview:self.retryBtn]; | ||
| 28 | + | ||
| 29 | + [self makeSubViewsConstraints]; | ||
| 30 | + [self.loadingView startAnimating]; | ||
| 31 | + | ||
| 32 | + } | ||
| 33 | + return self; | ||
| 34 | +} | ||
| 35 | + | ||
| 36 | +#pragma mark - | ||
| 37 | +#pragma mark - public methods | ||
| 38 | + | ||
| 39 | +- (void)startLoading | ||
| 40 | +{ | ||
| 41 | + [self.loadingView startAnimating]; | ||
| 42 | + _loadingLab.hidden = NO; | ||
| 43 | + self.retryBtn.hidden = YES; | ||
| 44 | + self.hidden = NO; | ||
| 45 | +} | ||
| 46 | + | ||
| 47 | +- (void)stopLoading | ||
| 48 | +{ | ||
| 49 | + [self.loadingView stopAnimating]; | ||
| 50 | + self.hidden = YES; | ||
| 51 | +} | ||
| 52 | + | ||
| 53 | +- (void)retry | ||
| 54 | +{ | ||
| 55 | + _retryBtn.hidden = NO; | ||
| 56 | + [_loadingView stopAnimating]; | ||
| 57 | + _loadingLab.hidden = YES; | ||
| 58 | +} | ||
| 59 | + | ||
| 60 | +#pragma mark - | ||
| 61 | +#pragma mark - action | ||
| 62 | +- (void)retryBtnAction | ||
| 63 | +{ | ||
| 64 | + [self startLoading]; | ||
| 65 | + if (self.delegate && [self.delegate respondsToSelector:@selector(retryBtnClick)]) { | ||
| 66 | + [self.delegate retryBtnClick]; | ||
| 67 | + } | ||
| 68 | +} | ||
| 69 | + | ||
| 70 | +#pragma mark - | ||
| 71 | +#pragma mark - makeSubViewsConstraints | ||
| 72 | +- (void)makeSubViewsConstraints | ||
| 73 | +{ | ||
| 74 | + | ||
| 75 | + [self.loadingView mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 76 | + make.centerX.mas_equalTo(self.width/2); | ||
| 77 | + make.top.mas_equalTo(0); | ||
| 78 | + }]; | ||
| 79 | + | ||
| 80 | + [self.loadingLab mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 81 | + make.left.mas_equalTo(0); | ||
| 82 | + make.top.mas_equalTo(40); | ||
| 83 | + make.width.equalTo(self); | ||
| 84 | + make.height.mas_equalTo(40); | ||
| 85 | + }]; | ||
| 86 | + | ||
| 87 | + [self.retryBtn mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 88 | + make.width.mas_equalTo(70); | ||
| 89 | + make.height.mas_equalTo(40); | ||
| 90 | + make.center.equalTo(self); | ||
| 91 | + }]; | ||
| 92 | + | ||
| 93 | +} | ||
| 94 | + | ||
| 95 | +#pragma mark - | ||
| 96 | +#pragma mark - getter | ||
| 97 | + | ||
| 98 | +- (UIActivityIndicatorView *)loadingView | ||
| 99 | +{ | ||
| 100 | + if (!_loadingView) { | ||
| 101 | + _loadingView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; | ||
| 102 | + } | ||
| 103 | + return _loadingView; | ||
| 104 | +} | ||
| 105 | + | ||
| 106 | +- (UILabel *)loadingLab | ||
| 107 | +{ | ||
| 108 | + if (!_loadingLab) { | ||
| 109 | + _loadingLab = [[UILabel alloc] init]; | ||
| 110 | + _loadingLab.text = @"努力加载中..."; | ||
| 111 | + _loadingLab.textColor = [UIColor whiteColor]; | ||
| 112 | + _loadingLab.textAlignment = NSTextAlignmentCenter; | ||
| 113 | + } | ||
| 114 | + return _loadingLab; | ||
| 115 | +} | ||
| 116 | + | ||
| 117 | +- (UIButton *)retryBtn | ||
| 118 | +{ | ||
| 119 | + if (!_retryBtn) { | ||
| 120 | + _retryBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 121 | + [_retryBtn setTitle:@"重试" forState:UIControlStateNormal]; | ||
| 122 | + [_retryBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; | ||
| 123 | + _retryBtn.hidden = YES; | ||
| 124 | + _retryBtn.layer.cornerRadius = 10; | ||
| 125 | + _retryBtn.layer.masksToBounds = YES; | ||
| 126 | + _retryBtn.layer.borderColor = [UIColor blackColor].CGColor; | ||
| 127 | + _retryBtn.layer.borderWidth = 1; | ||
| 128 | + [_retryBtn addTarget:self action:@selector(retryBtnAction) forControlEvents:UIControlEventTouchUpInside]; | ||
| 129 | + } | ||
| 130 | + return _retryBtn; | ||
| 131 | +} | ||
| 132 | + | ||
| 133 | +/* | ||
| 134 | +// Only override drawRect: if you perform custom drawing. | ||
| 135 | +// An empty implementation adversely affects performance during animation. | ||
| 136 | +- (void)drawRect:(CGRect)rect { | ||
| 137 | + // Drawing code | ||
| 138 | +} | ||
| 139 | +*/ | ||
| 140 | + | ||
| 141 | +@end |
LiveVideoCloud/LiveVideoCloud/Info.plist
| @@ -2,6 +2,8 @@ | @@ -2,6 +2,8 @@ | ||
| 2 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | 2 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
| 3 | <plist version="1.0"> | 3 | <plist version="1.0"> |
| 4 | <dict> | 4 | <dict> |
| 5 | + <key>UIViewControllerBasedStatusBarAppearance</key> | ||
| 6 | + <false/> | ||
| 5 | <key>CFBundleDevelopmentRegion</key> | 7 | <key>CFBundleDevelopmentRegion</key> |
| 6 | <string>en</string> | 8 | <string>en</string> |
| 7 | <key>CFBundleExecutable</key> | 9 | <key>CFBundleExecutable</key> |
| @@ -20,16 +22,25 @@ | @@ -20,16 +22,25 @@ | ||
| 20 | <string>1</string> | 22 | <string>1</string> |
| 21 | <key>LSRequiresIPhoneOS</key> | 23 | <key>LSRequiresIPhoneOS</key> |
| 22 | <true/> | 24 | <true/> |
| 25 | + <key>NSAppTransportSecurity</key> | ||
| 26 | + <dict> | ||
| 27 | + <key>NSAllowsArbitraryLoads</key> | ||
| 28 | + <true/> | ||
| 29 | + </dict> | ||
| 30 | + <key>NSCameraUsageDescription</key> | ||
| 31 | + <string></string> | ||
| 32 | + <key>NSMicrophoneUsageDescription</key> | ||
| 33 | + <string></string> | ||
| 23 | <key>UILaunchStoryboardName</key> | 34 | <key>UILaunchStoryboardName</key> |
| 24 | <string>LaunchScreen</string> | 35 | <string>LaunchScreen</string> |
| 25 | - <key>UIMainStoryboardFile</key> | ||
| 26 | - <string>Main</string> | ||
| 27 | <key>UIRequiredDeviceCapabilities</key> | 36 | <key>UIRequiredDeviceCapabilities</key> |
| 28 | <array> | 37 | <array> |
| 29 | <string>armv7</string> | 38 | <string>armv7</string> |
| 30 | </array> | 39 | </array> |
| 31 | <key>UISupportedInterfaceOrientations</key> | 40 | <key>UISupportedInterfaceOrientations</key> |
| 32 | <array> | 41 | <array> |
| 42 | + <string>UIInterfaceOrientationLandscapeLeft</string> | ||
| 43 | + <string>UIInterfaceOrientationLandscapeRight</string> | ||
| 33 | <string>UIInterfaceOrientationPortrait</string> | 44 | <string>UIInterfaceOrientationPortrait</string> |
| 34 | </array> | 45 | </array> |
| 35 | <key>UISupportedInterfaceOrientations~ipad</key> | 46 | <key>UISupportedInterfaceOrientations~ipad</key> |
LiveVideoCloud/LiveVideoCloud/PrefixHeader.pch
| @@ -24,6 +24,7 @@ | @@ -24,6 +24,7 @@ | ||
| 24 | #import "SVProgressHUD.h" | 24 | #import "SVProgressHUD.h" |
| 25 | #import "AFNetworking.h" | 25 | #import "AFNetworking.h" |
| 26 | #import "Masonry.h" | 26 | #import "Masonry.h" |
| 27 | + #import <CNLivePlayerSDK/CNLiveWebcastManager.h> | ||
| 27 | 28 | ||
| 28 | #if TARGET_OS_IPHONE | 29 | #if TARGET_OS_IPHONE |
| 29 | 30 |