Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8851047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:03:02+00:00 2026-06-14T13:03:02+00:00

Im trying to make an android application with live video streaming but whenever the

  • 0

Im trying to make an android application with live video streaming but whenever the related activity (this one) opens, it doesnt show anything except a blank screen. Can anyone please help me?

       package guc.edu.iremote;

import android.app.Activity;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.net.Uri;
import android.os.Bundle;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.view.Window;
import android.view.WindowManager;
import android.widget.MediaController;
import android.widget.VideoView;

public class Video extends Activity  implements OnTouchListener{

VideoView videoView;
int stopPosition;
boolean touched;
protected WakeLock mWakeLock;
Dialog dialog;



@SuppressWarnings("deprecation")
public void OnCreate(Bundle b) {
    super.onCreate(b);
    this.setContentView(R.layout.video);



    videoView = (VideoView) findViewById(R.id.videoView1);


    PowerManager lPwrMgr = (PowerManager) getSystemService(POWER_SERVICE);
    mWakeLock = lPwrMgr.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK,                 "Video");
    mWakeLock.acquire();


    videoView.setVisibility(View.VISIBLE);

    MediaController mc = new MediaController(this){
        @Override
        public void hide() {
            this.show(0);
        }

        @Override
        public void setMediaPlayer(MediaPlayerControl player) {
            super.setMediaPlayer(player);
            this.show();
        }
    };
    videoView.setMediaController(mc);
    mc.setAnchorView(videoView);

      dialog = ProgressDialog.show(Video.this, "", "Loading...",
            true);
    new Thread(new Runnable() {
        public void run() {

             String str = "rtsp://v4.cache2.c.youtube.com/"+
                    "CkELENy73wIaOAng93Xa-"+ 
                        "iQH5xMYESARFEIJbXYtZ29vZ2xlSARSBXdhdGNoWglDbGlja0xpbmtgg9fFkeTLublGDA==/"+ 
                    "0/0/0/video.3gp";  

            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
            Uri uri = Uri.parse(str);
            videoView.setVideoURI(uri);
             videoView.setOnTouchListener(this);
            videoView.requestFocus();
            videoView.setZOrderOnTop(false);
            videoView.start();
            dialog.dismiss();
        }
    }).start();





}



@Override
protected void onResume() {
    // TODO Auto-generated method stub
    super.onResume();
    //videoView.seekTo(stopPosition);
    //videoView.resume();
}


protected void onPause() {
    super.onPause();
    if (videoView != null) {
        stopPosition = videoView.getCurrentPosition();
        videoView.pause();
    }

}



public boolean onTouch(View v, MotionEvent event) {
    // TODO Auto-generated method stub
    if(v==videoView)
    {
        System.out.println("touched"); 

        if(!touched)
        {
            onPause();
            touched = true;
        }
        else
            onResume();
            touched  = false;
    }
    return false;
}

@Override
protected void onDestroy() {
    // TODO Auto-generated method stub
    super.onDestroy();

    // release wake-lock 
    if(mWakeLock != null){
        mWakeLock.release();
    }
}
}

AND THIS is for the XML

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <VideoView
        android:id="@+id/videoView1"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</FrameLayout> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T13:03:04+00:00Added an answer on June 14, 2026 at 1:03 pm

    what is that link:

    rtsp://v4.cache2.c.youtube.com/CkELENy73wIaOAng93Xa-iQH5xMYESARFEIJbXYtZ29vZ2xlSARSBXdhdGNoWglDbGlja0xpbmtgg9fFkeTLublGDA==/0/0/0/video.3gp

    ?

    it doesn’t seem to work. should maybe fix that link if it’s broken and then try it. But… to verify that this is the problem, can you replace it with the link to another video file that is working? (let me know if you need some, but google can provide a ton 🙂

    EDIT

    as the other guy (earlier other answer) commented, you also need to access your UI in the mainthread, and not in background thread. so you should post to UI thread like:

    Runnable r = new Runnable(){ /* the updating videoView stuff you wanted to do*/ };
    ctx.runOnUIThread(r); 
    

    where ctx is a reference to your current activity.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make application for tablet with Android 2.3 with this kind of
im trying to make an android application that whenever a user conncects to a
I am trying to make an android application, but to do so I am
i am trying to make a simple menu for my android application. But don't
I'm trying to make a preference screen for my android application, but I'm failing
I am trying to make simple notepad application for learning android development. So, to
I'm trying to make a notification in Android. But i get the error in
I'm trying to make a floating joystick for my android game but am unable
hey, im new to android development and trying to make my first application. What
I'm trying to make a custom titlebar for my first Android application. While I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.