#StackBounty: #ios #swift #camera #core-graphics #avcapturemoviefileoutput How to compose AVCaptureVideoPreviewLayer with other views o…

Bounty: 500

I have managed to setup a basic AVCaptureSession which records a video and saves it on device by using AVCaptureFileOutputRecordingDelegate. I have been searching through docs to understand how we can add statistics overlays on top of the video which is being recorded.

i.e.

enter image description here

As you can see in the above image. I have multiple overlays on top of video preview layer. Now, when I save my video output I would like to compose those views onto the video as well.

What have I tried so far?

  • Honestly, I am just jumping around on internet to find a reputable blog explaining how one would do this. But failed to find one.
  • I have read few places that one could render text layer overlays as described in following post by creating CALayer and adding it as a sublayer.
  • But, what about if I want to render MapView on top of the video being recorded. Also, I am not looking for screen capture. Some of the content on the screen will not be part of the final recording so I want to be able to cherry pick view that will be composed.

What am I looking for?

  1. Direction.
  2. No straight up solution
  3. Documentation link and class names I should be reading more about to create this.

Progress So Far:

I have managed to understand that I need to get hold of CVImageBuffer from CMSampleBuffer and draw text over it. There are things still unclear to me whether it is possible to somehow overlay MapView over the video that is being recorded.


Get this bounty!!!

#StackBounty: #ios #swift #uitableview #uiscrollview Can UITableView scroll with UICollectionView inside it?

Bounty: 50

I have the structures below…

enter image description here

I wrap two of collection views into tableview

One is in tableview header(Collection1), another is in tableview 1st row(Collection2).

All the functions are good (Both collection view).

just…

When I scroll up in Collection2, Collection1 will Not scroll up together, because I’m only scrolling the collectionViews not the tableview.

It only scroll together when I scroll in Collection1.

Is it possible to make the header view scroll with user just like app store’s index carousel header?

Or I just went to the wrong place, I should use other ways to approach.


Get this bounty!!!

#StackBounty: #javascript #android #ios #reactjs #react-native React Native: TextInput with state and AsyncStorage

Bounty: 200

When typing on the keyboard I was seeing some warnings about the input being ahead of the JS code..

Native TextInput(react native is awesome) is 4 events ahead of JS – try to make your JS faster.

So added the debounce and got this to “work”:

...
import { debounce } from 'lodash'
...
export default class App extends React.Component {
  constructor(props) {
    super(props)
    this.state = {
      data,
      indexRef: data.reduce((result, item, index) => {
        result[item.title] = index
        return result
      }, {}),
      ready: false,
    }

    this.updatePitch = this.updatePitch.bind(this)
    this.saveLocally = debounce(this.saveLocally, 300).bind(this)
  }
  ...
  updatePitch(id, text) {
    // Copy the data
    let data = [...this.state.data]
    const index = data.findIndex(obj => obj.id == id)
    data[index].pitch = text
    // Update the state
    this.setState({ data }, this.saveLocally(data))
  }

  saveLocally(data) {
    try {
      AsyncStorage.setItem('data', JSON.stringify(data))
      this.forceUpdate()
    } catch (error) {
      // Well..
    }
  }

  render() {
  ...

BTW: I’m doing some “prop drilling” for now – but planning to do use the Context API (react 16.3)

The warning seems to have gone by adding debounce (1).. But I’m seeing some strange issues – particularly on the iPhone 8 plus simulator (not seeing the same on iPhone 6 simulator or Android device)

Issues observed:

  • TextInput don’t expand – it just add scolling (expands on iPhone 6 and Android device)
  • Some layout issues in the FlatList – seems like it has problems finding correct height of list elements..

What is the best practice for fast JS code and saving to both state and AsyncStorage?

(1) One other way than using debounce could be to use getDerivedStateFromProps and add some sort of timer pushing the state to the parent component after some period of time.. But wasn’t sure that this would make the JS code faster. So didn’t try it.

UPDATE

Had a request to show my data structure:

{
  "data": [
    {
      "id": "H3D1",
      "title": "Produkt",
      "pitch": "",
      "questions": [
        "Hvad er produktet?  ",
        "Hvilken værdi skaber det?  ",
        "Hvad er unikt?  ",
        "Hvordan er kvaliteten?  ",
        "Hvad er udsalgsprisen?  ",
        "Er prisen konkurrencedygtig?  ",
        "Hvor meget tjenes der på ét salg?  ",
        "Ejes der patenter/licenser?  "
      ]
    },
 ...
 ]
}

I currently save it locally in a JSON “template” file called data.json and load it initially.

import { data } from '../data.json'

export default class App extends React.Component {
  constructor(props) {
    super(props)
    this.state = {
      data,
      indexRef: data.reduce((result, item, index) => {
        result[item.title] = index
        return result
      }, {}),
      ready: false,
    }

and then retrieve the end users version via async componentDidMount by some await AsyncStorage.

  async componentDidMount() {
    SplashScreen.hide()
    try {
      let BusinessPlan = await AsyncStorage.getItem('BusinessPlan')
      if (BusinessPlan !== null) {
        // We have data!!
        let data = JSON.parse(BusinessPlan)
        data = this.state.data.map(item => {
          const index = data.findIndex(obj => obj.id == item.id)
          const pitch = index >= 0 ? data[index].pitch : ''
          return { ...item, pitch }
        })
        this.setState({ data, ready: true })
      } else {
        this.setState({ ready: true })
      }
    } catch (error) {
      // Error retrieving data
    }
  }


Get this bounty!!!

#StackBounty: #javascript #ios #reactjs #react-native #cocoapods <React/RCTDefines.h> file not found

Bounty: 50

I am Using cocoapods to install react native and react. I just want to use a toast component(https://www.npmjs.com/package/react-native-simple-toast) which does ti have a cocoapods Installation. when i install and and run the app I am getting an error “” file not found error.
I have added header search path but still getting this error.
1)error
enter image description here

2)react-native-simple-toast xcode project Header search path
enter image description here

3) Main project Header search path
enter image description here


Get this bounty!!!

#StackBounty: #ios #css #objective-c #xcode Load .CSS file from within app in uiwebview

Bounty: 50

i am trying to load .js and .css files from within app resources to uiwebview. and i am able to load .js file but can not load .css file please help. here is my code

- (void)webViewDidFinishLoad:(UIWebView *)webView {
    //NSString *cssFile = @"styling.css";

    NSString *jsFile = @"storage.js";
    NSString *jsFilePath = [[NSBundle mainBundle] pathForResource:jsFile ofType:nil];
    NSURL *jsURL = [NSURL fileURLWithPath:jsFilePath];
    NSString *javascriptCode = [NSString stringWithContentsOfFile:jsURL.path encoding:NSUTF8StringEncoding error:nil];
    [webView stringByEvaluatingJavaScriptFromString:javascriptCode];
}

this code it working perfectly for .js file but how can i use .css file in it?


Get this bounty!!!

#StackBounty: #ios #objective-c #gif #uiactivityviewcontroller Gif shared through UIActivityViewController comes out as static image in…

Bounty: 150

I’m trying to share a gif from my (unity) app, through the standard iOS sharing screen, to a social network.

Because of this question I first wrap the path to the gif in an NSURL before sending it to the UIActivityViewController:

NSURL *nsGifURL = [NSURL fileURLWithPath:nsGifPath];
NSArray *itemsToShare = @[nsMessage, nsGifURL];

// find the unity window:
UIWindow *window = [UIApplication sharedApplication].keyWindow;
UIActivityViewController *share = [[UIActivityViewController alloc] initWithActivityItems:itemsToShare applicationActivities:nil];
[window.rootViewController presentViewController:share animated:YES completion:nil];

This all compiles and runs without errors, but when I reach the other app, the image is static and not a gif.

How do I make apps like fb accept and display a gif on the other end?

EDIT: the nsGifPath definitely has the .gif extension


Get this bounty!!!

#StackBounty: #ios #objective-c #ffmpeg How do I use the CLI interface of FFMpeg from a static build?

Bounty: 500

I have added this (https://github.com/kewlbear/FFmpeg-iOS-build-script) version of ffmpeg to my project. I can’t see the entry point to the library in the headers included.

How do I get access to the same text command based system that the stand alone application has, or an equivalent?

I would also be happy if someone could point me towards documentation that allows you to use FFmpeg without the command line interface.

This is what I am trying to execute (I have it working on windows and android using the CLI version of ffmpeg)

ffmpeg -framerate 30 -i snap%03d.jpg -itsoffset 00:00:03.23333 -itsoffset 00:00:05 -i soundEffect.WAV -c:v libx264 -vf fps=30 -pix_fmt yuv420p result.mp4


Get this bounty!!!