Skip to content

Instantly share code, notes, and snippets.

View gergardiol's full-sized avatar
🎯
Focusing

German gergardiol

🎯
Focusing
View GitHub Profile
@gergardiol
gergardiol / MyAirplayApp.js
Created January 29, 2020 06:04
Airplay react native integration library - full code
import React from 'react';
import { Platform, View } from 'react-native';
import { AirPlayButton } from 'react-native-airplay-btn';
import Video from 'react-native-video';
const styles = {
backgroundVideo: {
position: 'absolute',
top: 0,
left: 0,
@gergardiol
gergardiol / MyAirplayApp.js
Created January 29, 2020 05:32
Airplay react native integration library code
import React from 'react';
import { Platform } from 'react-native';
import { AirPlayButton } from 'react-native-airplay-btn';
const MyAirplayApp = () => Platform.OS === 'ios' && <AirPlayButton style={{ height: 30, width: 30 }} />;
export default MyAirplayApp;
#import <GoogleCast/GoogleCast.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// ADD THIS CODE SNIPPET ->
GCKDiscoveryCriteria *criteria = [[GCKDiscoveryCriteria alloc] initWithApplicationID:kGCKDefaultMediaReceiverApplicationID];
GCKCastOptions* options = [[GCKCastOptions alloc] initWithDiscoveryCriteria:criteria];
[GCKCastContext setSharedInstanceWithOptions:options];
// -
return YES;
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapplication">
<application
<meta-data
android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"
android:value="com.reactnative.googlecast.GoogleCastOptionsProvider" />
</application>
</manifest>
@gergardiol
gergardiol / MainActivity.java
Created January 23, 2020 03:07
GoogleCastActivity
package com.myapplication;
import com.facebook.react.GoogleCastActivity;
public class MainActivity extends GoogleCastActivity {
// ..
}
import React from 'react';
import { TouchableOpacity, View, Text } from 'react-native';
import GoogleCast, { CastButton } from 'react-native-google-cast';
class MyChromecastApp extends React.Component {
// Play the casting, only if the device is connected and was playing something before in the actual sesion
playCast = () => GoogleCast.play();
// Pause the currently casting
pauseCast = () => GoogleCast.pause();
@gergardiol
gergardiol / App.js
Created November 28, 2019 15:55
Example code for codepush library integration with React Native
import codePush from 'react-native-code-push';
const codePushOptions = { checkFrequency: codePush.CheckFrequency.ON_APP_START };
class MyApp extends Component {
render() {
return (
<View>
/* My App Code.. */
</View>