Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- cvlc -q /home/pi/images/${3} --sout="#standard{access=http,user=${1},pwd=${2},mux=ts,dst=:8090}"
- import android.app.Activity;
- import android.content.Intent;
- import android.media.MediaPlayer;
- import android.net.Uri;
- import android.os.Bundle;
- import android.util.Base64;
- import java.io.IOException;
- import java.util.HashMap;
- import java.util.Map;
- public class ShowVideo extends Activity
- {
- String videoUri, id, password;
- @Override
- protected void onCreate(Bundle savedInstanceState)
- {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.showvideo_activity);
- Intent intent = getIntent();
- videoUri = intent.getStringExtra("uri");
- id = intent.getStringExtra("id");
- password = intent.getStringExtra("password");
- MediaPlayer media = new MediaPlayer();
- byte[] toEncrypt = (id + ":" + password).getBytes();
- String encoded = Base64.encodeToString(toEncrypt, Base64.DEFAULT);
- Map<String, String> headers = new HashMap<>();
- headers.put("Authorization", "Basic " + encoded);
- Uri uri = Uri.parse(videoUri);
- try
- {
- media.setDataSource(this,uri,headers);
- }
- catch (IOException e)
- {
- }
- media.prepareAsync();
- media.setOnPreparedListener(new MediaPlayer.OnPreparedListener()
- {
- public void onPrepared(MediaPlayer mp)
- {
- mp.start();
- }
- });
- }
- @Override
- public void onBackPressed()
- {
- setResult(MainActivity.RETURN_STREAM);
- super.onBackPressed();
- overridePendingTransition(R.anim.pull_in_right, R.anim.push_out_left);
- }
- }
Add Comment
Please, Sign In to add comment