diff --git a/Example/app/jsx/screens/SingleExample.js b/Example/app/jsx/screens/SingleExample.js index ba1db16b..a42d204d 100644 --- a/Example/app/jsx/screens/SingleExample.js +++ b/Example/app/jsx/screens/SingleExample.js @@ -1,15 +1,24 @@ import React, {useRef} from 'react'; -import {StatusBar} from 'react-native'; +import {StatusBar, Platform} from 'react-native'; import Player from '../components/Player'; import PlayerContainer from '../components/PlayerContainer'; export default () => { const playerRef = useRef([]); - + const toggled = useRef(false); const onTime = e => { - // var {position, duration} = e.nativeEvent; + var {position, duration} = e.nativeEvent; // eslint-disable-line // console.log('onTime was called with: ', position, duration); + if(!toggled.current){ + let intPosition = parseInt(position); + if(intPosition === 2){ + playerRef.current?.pause(); + playerRef.current?.play(); + toggled.current = true; + console.log("Toggled"); + } + } }; const onFullScreen = () => { @@ -26,13 +35,39 @@ export default () => { ref={playerRef} style={{flex: 1}} config={{ + license: + Platform.OS === 'android' ? '2lIcGBOLhVbO5e03gyl/ZDTDRmF36+QtAwVdNlugpwItBkiJmtkzYKBSxOo=' : 'BoE2PBlHT9SWuqa5MCxSHMlZGvwaqoIAg9KzHUZKozPJxmx1mQA34gbXLKU=', autostart: true, playlist: [ { file: 'https://playertest.longtailvideo.com/adaptive/oceans/oceans.m3u8', image: 'https://d3el35u4qe4frz.cloudfront.net/bkaovAYt-480.jpg', + tracks: [ + { + file: 'https://content.jwplatform.com/tracks/41bJbYlM.vtt', + label: 'Spanish', + }, + { + file: 'https://content.jwplatform.com/tracks/OfVl3pzA.srt', + label: 'Chinese', + default: true, + } + ] }, ], + advertising: { + adClient: 'ima', + adSchedule: [ + { + offset: '10', + tag: 'https://pubads.g.doubleclick.net/gampad/ads?iu=/22859175415/flixsnip-player-ads&description_url=https%3A%2F%2Fflixsnip.com&tfcd=0&npa=0&sz=400x300%7C640x480&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&vad_type=linear' + }, + { + offset: '20', + tag: 'https://pubads.g.doubleclick.net/gampad/ads?iu=/22859175415/flixsnip-player-ads&description_url=https%3A%2F%2Fflixsnip.com&url=https%3A%2F%2Fflixsnip.com&sz=400x300%7C640x480&gdfp_req=1&unviewed_position_start=1&env=vp&vad_type=linear&output=vast' + } + ] + }, styling: { colors: {}, }, diff --git a/Example/ios/Podfile b/Example/ios/Podfile index 37855a77..b5226538 100644 --- a/Example/ios/Podfile +++ b/Example/ios/Podfile @@ -1,7 +1,7 @@ require_relative '../node_modules/react-native/scripts/react_native_pods' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' -platform :ios, '12.0' +platform :ios, '13.0' install! 'cocoapods', :deterministic_uuids => false target 'RNJWPlayer' do diff --git a/Example/ios/Podfile.lock b/Example/ios/Podfile.lock index 7e7ed41f..081cf1f1 100644 --- a/Example/ios/Podfile.lock +++ b/Example/ios/Podfile.lock @@ -78,10 +78,11 @@ PODS: - Protobuf (~> 3.13) - google-cast-sdk/Core (4.7.0): - Protobuf (~> 3.13) - - JWPlayerKit (4.6.2) + - GoogleAds-IMA-iOS-SDK (3.14.5) + - JWPlayerKit (4.10.0) - libevent (2.1.12) - OpenSSL-Universal (1.1.1100) - - Protobuf (3.21.2) + - Protobuf (3.22.0) - RCT-Folly (2021.06.28.00-v2): - boost - DoubleConversion @@ -370,11 +371,12 @@ PODS: - React - RNGestureHandler (2.4.2): - React-Core - - RNJWPlayer (0.2.24): + - RNJWPlayer (0.2.27): - google-cast-sdk (~> 4.7.0) - - JWPlayerKit (~> 4.6.2) + - GoogleAds-IMA-iOS-SDK (~> 3.14.3) + - JWPlayerKit (~> 4.10.0) - React - - RNScreens (3.13.1): + - RNScreens (3.14.1): - React-Core - React-RCTImage - RNVectorIcons (8.1.0): @@ -445,7 +447,7 @@ DEPENDENCIES: - RNDeviceInfo (from `../node_modules/react-native-device-info`) - RNFS (from `../node_modules/react-native-fs`) - RNGestureHandler (from `../node_modules/react-native-gesture-handler`) - - RNJWPlayer (from `../node_modules/react-native-jw-media-player/ios`) + - RNJWPlayer (from `../node_modules/react-native-jw-media-player`) - RNScreens (from `../node_modules/react-native-screens`) - RNVectorIcons (from `../node_modules/react-native-vector-icons`) - Yoga (from `../node_modules/react-native/ReactCommon/yoga`) @@ -464,6 +466,7 @@ SPEC REPOS: - FlipperKit - fmt - google-cast-sdk + - GoogleAds-IMA-iOS-SDK - JWPlayerKit - libevent - OpenSSL-Universal @@ -545,7 +548,7 @@ EXTERNAL SOURCES: RNGestureHandler: :path: "../node_modules/react-native-gesture-handler" RNJWPlayer: - :path: "../node_modules/react-native-jw-media-player/ios" + :path: "../node_modules/react-native-jw-media-player" RNScreens: :path: "../node_modules/react-native-screens" RNVectorIcons: @@ -571,10 +574,11 @@ SPEC CHECKSUMS: fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9 glog: 476ee3e89abb49e07f822b48323c51c57124b572 google-cast-sdk: 6731e9a206ce43e0f4433d15598ad8a19f0371d5 - JWPlayerKit: f72f577e907b450f76f0185233eab45db285d21b + GoogleAds-IMA-iOS-SDK: b088674002266c5638e73d10696c8b13872ee15e + JWPlayerKit: 39faf31167189fdcb35f0e6b2a61df2c15a0c6cc libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913 OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c - Protobuf: 818c6a87e44193a77f56b87c6a1c106efda7e062 + Protobuf: 5e6cbc143d02fe08585d86b0098f8b755d2caaab RCT-Folly: 4d8508a426467c48885f1151029bc15fa5d7b3b8 RCTRequired: 00581111c53531e39e3c6346ef0d2c0cf52a5a37 RCTTypeSafety: 07e03ee7800e7dd65cba8e52ad0c2edb06c96604 @@ -606,13 +610,13 @@ SPEC CHECKSUMS: RNDeviceInfo: 1e3f62b9ec32f7754fac60bd06b8f8a27124e7f0 RNFS: 2bd9eb49dc82fa9676382f0585b992c424cd59df RNGestureHandler: 61628a2c859172551aa2100d3e73d1e57878392f - RNJWPlayer: bd590297f22d85c19885b40a7465cfa991ef6556 - RNScreens: 40a2cb40a02a609938137a1e0acfbf8fc9eebf19 + RNJWPlayer: 232b3424759ab8fce700134b87e64120091d882c + RNScreens: aa9a97835afbbdc18a4757870b2b59b7d9fae16a RNVectorIcons: 31cebfcf94e8cf8686eb5303ae0357da64d7a5a4 SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608 Yoga: 17cd9a50243093b547c1e539c749928dd68152da YogaKit: f782866e155069a2cca2517aafea43200b01fd5a -PODFILE CHECKSUM: 72302fbb90a843c0cefdfb43fe4bd7e42dee995b +PODFILE CHECKSUM: 183176a62fadac6342b1b2b4607c7371f88c8773 COCOAPODS: 1.11.3 diff --git a/Example/ios/RNJWPlayer.xcodeproj/project.pbxproj b/Example/ios/RNJWPlayer.xcodeproj/project.pbxproj index f3c83602..8f15a400 100644 --- a/Example/ios/RNJWPlayer.xcodeproj/project.pbxproj +++ b/Example/ios/RNJWPlayer.xcodeproj/project.pbxproj @@ -496,8 +496,8 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = ""; + CURRENT_PROJECT_VERSION = 5; + DEVELOPMENT_TEAM = Y38UUHXV5M; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -546,17 +546,19 @@ "\"$(PODS_TARGET_SRCROOT)/include/\"", ); INFOPLIST_FILE = RNJWPlayer/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + INFOPLIST_KEY_CFBundleDisplayName = PovioRNPlayer; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); + MARKETING_VERSION = 1.1; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", "-lc++", ); - PRODUCT_BUNDLE_IDENTIFIER = com.appgoalz.RNJWPlayer; + PRODUCT_BUNDLE_IDENTIFIER = com.povio.RNJWPlayer; PRODUCT_NAME = RNJWPlayer; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; @@ -571,8 +573,8 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = ""; + CURRENT_PROJECT_VERSION = 5; + DEVELOPMENT_TEAM = Y38UUHXV5M; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"${PODS_ROOT}/OpenSSL-Universal/Frameworks\"", @@ -620,17 +622,19 @@ "\"$(PODS_TARGET_SRCROOT)/include/\"", ); INFOPLIST_FILE = RNJWPlayer/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + INFOPLIST_KEY_CFBundleDisplayName = PovioRNPlayer; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); + MARKETING_VERSION = 1.1; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", "-lc++", ); - PRODUCT_BUNDLE_IDENTIFIER = com.appgoalz.RNJWPlayer; + PRODUCT_BUNDLE_IDENTIFIER = com.povio.RNJWPlayer; PRODUCT_NAME = RNJWPlayer; SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; diff --git a/Example/ios/RNJWPlayer/Info.plist b/Example/ios/RNJWPlayer/Info.plist index de8e772e..727de9bc 100644 --- a/Example/ios/RNJWPlayer/Info.plist +++ b/Example/ios/RNJWPlayer/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.0 + 1.1 CFBundleSignature ???? CFBundleVersion @@ -33,7 +33,7 @@ localhost NSExceptionAllowsInsecureHTTPLoads - + @@ -86,5 +86,9 @@ network. UIViewControllerBasedStatusBarAppearance + NSBluetoothPeripheralUsageDescription + Bluetooth + NSMicrophoneUsageDescription + Microphone diff --git a/Example/package.json b/Example/package.json index 427bec66..fa8c8a66 100644 --- a/Example/package.json +++ b/Example/package.json @@ -19,10 +19,10 @@ "react-native-fs": "2.16.6", "react-native-gesture-handler": "2.4.2", "react-native-iphone-x-helper": "1.3.1", - "react-native-jw-media-player": "0.2.24", + "react-native-jw-media-player": "0.2.27", "react-native-orientation-locker": "1.4.0", "react-native-safe-area-context": "4.2.5", - "react-native-screens": "3.13.1", + "react-native-screens": "3.14.1", "react-native-status-bar-height": "2.6.0", "react-native-vector-icons": "8.1.0" }, diff --git a/Example/yarn.lock b/Example/yarn.lock index d5c97864..677f112b 100644 --- a/Example/yarn.lock +++ b/Example/yarn.lock @@ -6554,10 +6554,10 @@ react-native-iphone-x-helper@1.3.1: resolved "https://registry.yarnpkg.com/react-native-iphone-x-helper/-/react-native-iphone-x-helper-1.3.1.tgz#20c603e9a0e765fd6f97396638bdeb0e5a60b010" integrity sha512-HOf0jzRnq2/aFUcdCJ9w9JGzN3gdEg0zFE4FyYlp4jtidqU03D5X7ZegGKfT1EWteR0gPBGp9ye5T5FvSWi9Yg== -react-native-jw-media-player@0.2.23: - version "0.2.23" - resolved "https://registry.yarnpkg.com/react-native-jw-media-player/-/react-native-jw-media-player-0.2.23.tgz#f7e4c7ff1febd4fb66f80f98d0b5c442f695399f" - integrity sha512-PfKfptvT/Q0JlirPgRP9Vp5WqN1AJrcYz/wOLqPnjSqOGtL8PFWMtS6adLJ1kYb0WbcbB/RLoNOCzTOshsWLWw== +react-native-jw-media-player@0.2.27: + version "0.2.27" + resolved "https://registry.yarnpkg.com/react-native-jw-media-player/-/react-native-jw-media-player-0.2.27.tgz#72f0497884c9fcc20096763c94ca7652a10cd21c" + integrity sha512-t2C8oScrIsXqceVtkygTLHP0IpjN0n66Fd/UaiWv3qzLvAfK99xwHJ6gNOXyeuwSCsfOV/D11wfwmZg6h4aVWw== react-native-orientation-locker@1.4.0: version "1.4.0" @@ -6569,10 +6569,10 @@ react-native-safe-area-context@4.2.5: resolved "https://registry.yarnpkg.com/react-native-safe-area-context/-/react-native-safe-area-context-4.2.5.tgz#23006dc1a398bb825d7d795c27f1c46119efe8a5" integrity sha512-nUil2de1gk/8ZB9IzIxFyGCiKeAYcHzJb/Tks2NzSkev1qH4MNR05DWYDSmW6vLT+y4mospLVyG/H5dyUd+KQQ== -react-native-screens@3.13.1: - version "3.13.1" - resolved "https://registry.yarnpkg.com/react-native-screens/-/react-native-screens-3.13.1.tgz#b3b1c5788dca25a71668909f66d87fb35c5c5241" - integrity sha512-xcrnuUs0qUrGpc2gOTDY4VgHHADQwp80mwR1prU/Q0JqbZN5W3koLhuOsT6FkSRKjR5t40l+4LcjhHdpqRB2HA== +react-native-screens@3.14.1: + version "3.14.1" + resolved "https://registry.yarnpkg.com/react-native-screens/-/react-native-screens-3.14.1.tgz#9eca8ef524cc0466701779498d128d820cc06f69" + integrity sha512-QkaiYEx5kuAkLjfN+AmR7FC9jyzohqnc5T1PBi35oZtGiLMoyTJIzyep/g8458++WvDwm0vismIifaNHsWFyHg== dependencies: react-freeze "^1.0.0" warn-once "^0.1.0" diff --git a/ios/RNJWPlayer.xcodeproj/project.pbxproj b/ios/RNJWPlayer.xcodeproj/project.pbxproj index 5077f25e..841a7115 100644 --- a/ios/RNJWPlayer.xcodeproj/project.pbxproj +++ b/ios/RNJWPlayer.xcodeproj/project.pbxproj @@ -13,6 +13,7 @@ 2AA52BE826C144B200AD26AE /* RNJWPlayerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2AA52BE426C144B200AD26AE /* RNJWPlayerView.m */; }; 3BC75FCC1E43B1DB0011FBAA /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BC75FCB1E43B1DB0011FBAA /* UIKit.framework */; }; 3BC75FD11E43B3090011FBAA /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BC75FD01E43B3090011FBAA /* Foundation.framework */; }; + 99A84E71296727BE00A71DEC /* RNJWPlayerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 99A84E6F296727BE00A71DEC /* RNJWPlayerViewController.m */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -38,6 +39,8 @@ 2AA52BE426C144B200AD26AE /* RNJWPlayerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RNJWPlayerView.m; path = RNJWPlayer/RNJWPlayerView.m; sourceTree = ""; }; 3BC75FCB1E43B1DB0011FBAA /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 3BC75FD01E43B3090011FBAA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 99A84E6F296727BE00A71DEC /* RNJWPlayerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RNJWPlayerViewController.m; path = RNJWPlayer/RNJWPlayerViewController.m; sourceTree = ""; }; + 99A84E70296727BE00A71DEC /* RNJWPlayerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RNJWPlayerViewController.h; path = RNJWPlayer/RNJWPlayerViewController.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -75,6 +78,8 @@ 58B511D21A9E6C8500147676 = { isa = PBXGroup; children = ( + 99A84E70296727BE00A71DEC /* RNJWPlayerViewController.h */, + 99A84E6F296727BE00A71DEC /* RNJWPlayerViewController.m */, 2AA52BE126C144B200AD26AE /* RNJWPlayerView.h */, 2AA52BE426C144B200AD26AE /* RNJWPlayerView.m */, 2AA52BE326C144B200AD26AE /* RNJWPlayerViewManager.h */, @@ -145,6 +150,7 @@ files = ( 2AA52BE826C144B200AD26AE /* RNJWPlayerView.m in Sources */, 2A5DC7C0272B5DB6003BF3E4 /* RCTConvert+RNJWPlayer.m in Sources */, + 99A84E71296727BE00A71DEC /* RNJWPlayerViewController.m in Sources */, 2AA52BE726C144B200AD26AE /* RNJWPlayerViewManager.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/ios/RNJWPlayer/RNJWPlayerView.m b/ios/RNJWPlayer/RNJWPlayerView.m index 1c27a9f6..de5206b5 100644 --- a/ios/RNJWPlayer/RNJWPlayerView.m +++ b/ios/RNJWPlayer/RNJWPlayerView.m @@ -695,6 +695,9 @@ -(void)setupPlayerViewController:config :(JWPlayerConfiguration*)playerConfig _playerViewController.offlinePosterImage = image; } } + + // hide airplay and chromecast buttons + [_playerViewController disableCastingButtons]; [self presentPlayerViewController:playerConfig]; } diff --git a/ios/RNJWPlayer/RNJWPlayerViewController.h b/ios/RNJWPlayer/RNJWPlayerViewController.h index 51358b13..2841aa1a 100644 --- a/ios/RNJWPlayer/RNJWPlayerViewController.h +++ b/ios/RNJWPlayer/RNJWPlayerViewController.h @@ -26,5 +26,6 @@ -(void)setDelegates; -(void)removeDelegates; +-(void)disableCastingButtons; @end diff --git a/ios/RNJWPlayer/RNJWPlayerViewController.m b/ios/RNJWPlayer/RNJWPlayerViewController.m index de1175b9..eacfc55a 100644 --- a/ios/RNJWPlayer/RNJWPlayerViewController.m +++ b/ios/RNJWPlayer/RNJWPlayerViewController.m @@ -31,6 +31,11 @@ -(void)removeDelegates self.player.contentKeyDataSource = nil; } +-(void)disableCastingButtons +{ +// [self setVisibility:0 forControls:@[@3, @4]]; +} + #pragma mark - JWPlayer Delegate - (void)jwplayerIsReady:(id)player @@ -132,6 +137,8 @@ - (void)playerViewController:(JWPlayerViewController *)controller sizeChangedFro NSError* error = nil; NSData* data = [NSJSONSerialization dataWithJSONObject:sizesDict options:NSJSONWritingPrettyPrinted error: &error]; _parentView.onPlayerSizeChange(@{@"sizes": data}); + + [controller setVisibility:0 for:@[@3, @4]]; } }