Skip to content

Chore/Disable casting #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 38 additions & 3 deletions Example/app/jsx/screens/SingleExample.js
Original file line number Diff line number Diff line change
@@ -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 = () => {
Expand All @@ -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: {},
},
Expand Down
2 changes: 1 addition & 1 deletion Example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
28 changes: 16 additions & 12 deletions Example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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`)
Expand All @@ -464,6 +466,7 @@ SPEC REPOS:
- FlipperKit
- fmt
- google-cast-sdk
- GoogleAds-IMA-iOS-SDK
- JWPlayerKit
- libevent
- OpenSSL-Universal
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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
20 changes: 12 additions & 8 deletions Example/ios/RNJWPlayer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down Expand Up @@ -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;
Expand All @@ -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\"",
Expand Down Expand Up @@ -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";
Expand Down
8 changes: 6 additions & 2 deletions Example/ios/RNJWPlayer/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand All @@ -33,7 +33,7 @@
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<false/>
</dict>
</dict>
</dict>
Expand Down Expand Up @@ -86,5 +86,9 @@ network.</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>Bluetooth</string>
<key>NSMicrophoneUsageDescription</key>
<string>Microphone</string>
</dict>
</plist>
4 changes: 2 additions & 2 deletions Example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
16 changes: 8 additions & 8 deletions Example/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
6 changes: 6 additions & 0 deletions ios/RNJWPlayer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -38,6 +39,8 @@
2AA52BE426C144B200AD26AE /* RNJWPlayerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RNJWPlayerView.m; path = RNJWPlayer/RNJWPlayerView.m; sourceTree = "<group>"; };
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 = "<group>"; };
99A84E70296727BE00A71DEC /* RNJWPlayerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RNJWPlayerViewController.h; path = RNJWPlayer/RNJWPlayerViewController.h; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -75,6 +78,8 @@
58B511D21A9E6C8500147676 = {
isa = PBXGroup;
children = (
99A84E70296727BE00A71DEC /* RNJWPlayerViewController.h */,
99A84E6F296727BE00A71DEC /* RNJWPlayerViewController.m */,
2AA52BE126C144B200AD26AE /* RNJWPlayerView.h */,
2AA52BE426C144B200AD26AE /* RNJWPlayerView.m */,
2AA52BE326C144B200AD26AE /* RNJWPlayerViewManager.h */,
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions ios/RNJWPlayer/RNJWPlayerView.m
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,9 @@ -(void)setupPlayerViewController:config :(JWPlayerConfiguration*)playerConfig
_playerViewController.offlinePosterImage = image;
}
}

// hide airplay and chromecast buttons
[_playerViewController disableCastingButtons];

[self presentPlayerViewController:playerConfig];
}
Expand Down
1 change: 1 addition & 0 deletions ios/RNJWPlayer/RNJWPlayerViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@

-(void)setDelegates;
-(void)removeDelegates;
-(void)disableCastingButtons;

@end
7 changes: 7 additions & 0 deletions ios/RNJWPlayer/RNJWPlayerViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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<JWPlayer>)player
Expand Down Expand Up @@ -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]];
}
}

Expand Down