Module2. Streaming - GachonCapstoneDesign/DoorWatcher GitHub Wiki

Summary:

Streaming scenes using a camera of Raspberry Pie to your smartphone.

Introduction

Here are the files we need to use to use streaming.

python file

app.py
camera.py

HTML file

index.html

Android file

SplashActivity.java
MainActivity.java
StreamingActivity.java
GCMBroadcastReceiver.java
QuickstartPreferences.java
RegistrationIntentService.java

This code is now on the github.

  • Github. Click the hyperlink to go to the github repository

1. External network configuration

In order to access Raspberry Pi from external network, we set the IP address of Internet connected to Raspberry Pi to connect from external network. How to set up connection from external network is explained in detail by clicking URL below.

  • If you want to see an explanation, please click URL.

2. Run 'app.py' from the raspberry pi

When you run this file, Raspberry Pi will open its own web server. When an access request is made to the opened web server, the requestor displays index.html in the templates folder. It also displays the frame that the Raspberry pi camera module takes on index.html. The streaming is doing by the user to show the screen shot by the camera on the index.html. At this time, Access requests to the web streaming will reduce the load of Raspberry pi. Access to the web is addressed to:

[Raspberry Pi IP address]:5000

3. Enter the Android project and open 'StreamingActivity.java'

browser = (WebView) findViewById(R.id.webview1);
browser.getSettings().setJavaScriptEnabled(true);
browser.loadUrl("http:/192.168.0.12:5000/");

In the upper part, change the IP Address to your Raspberry IP Address. You can also set password and id after login activity. The default is `id:" ", pwd:" "`.

4. Turn on the application and check the streaming

If you run app.py from Raspberry Pie and install the project on your smartphone and run it, you can stream it.





[ 한글 위키 ]

Summary:

라즈베리파이의 카메라를 이용해서 스트리밍하는 장면을 스마트폰으로 스트리밍 합니다.

Introduction

저희가 제공하는 Streaming 을 이용하기 위해 사용해야 하는 파일은 다음과 같습니다.

python file

app.py
camera.py

HTML file

index.html

Android file

SplashActivity.java
MainActivity.java
StreamingActivity.java
GCMBroadcastReceiver.java
QuickstartPreferences.java
RegistrationIntentService.java

이 코드는 현재 깃허브에 올려놨습니다.

  • Github. 하이퍼링크를 클릭하시면 깃허브 페이지로 이동합니다.

1.외부망에서 접근 가능하도록 설정합니다.

외부망에서 라즈베리파이에 접근하기위해선 라즈베리파이에 연결된 인터넷의 IP address를 외부망에서 접속할 수 있게 설정해 놓습니다.
외부망에서 접속 가능하게 설정하는 방법은 아래 URL을 클릭하시면 자세하게 설명되어 있습니다.

  • 설명을 보고싶으시면 URL을 클릭해 주세요.

2.라즈베리파이에서 app.py 를 실행합니다.

이 파일을 실행하게되면 라즈베리파이 자체적으로 웹서버를 열게됩니다.
열어놓은 웹서버에 접근 요청이 오면 요청자에게 templates 폴더속의 index.html을 띄워줍니다.
또한 라즈베리파이 카메라 모듈이 찍는 frame을 index.html에 띄워줍니다. 계속해서 카메라 모듈에서 찍는 화면을 index.html에 띄워주는걸 유저가 봄으로써 스트리밍이 이루어집니다.
이때 웹에 Access 요청이 오면 스트리밍이 되므로 라즈베리파이의 부하를 줄여줍니다.
웹의 접근은 아래와 같은 주소로 접근합니다.

[라즈베리 파이 IP주소]:5000

3.Android project에 들어가서 StreamingActivity.java를 엽니다.

browser = (WebView) findViewById(R.id.webview1);
browser.getSettings().setJavaScriptEnabled(true);
browser.loadUrl("http:/192.168.0.12:5000/");

위 부분에 IP Address를 자신의 라즈베리파이 IP Address로 변경합니다.
또한 Login Activity에 들어가면 비밀번호와 아이뒤 설정을 할 수있습니다.
기본값으로 id : "", pwd : "" 으로 설정되어 있습니다.

4.어플리케이션을 켜고 스트리밍을 확인합니다.

라즈베리파이에서 app.py를 실행한 상태에서 프로젝트를 스마트폰에 설치하고 실행하게 스트리밍이 가능합니다.

⚠️ **GitHub.com Fallback** ⚠️