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

  • Home
  • SEARCH
  • 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 8849927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:46:47+00:00 2026-06-14T12:46:47+00:00

I want an Android phone to control a video stream playback on a Samsung

  • 0

I want an Android phone to control a video stream playback on a Samsung Smart TV. I can send a UPnP command to the TV with a URL to the video stream. Unfortunately the Samsung TV don’t accept URLs that point outside the local network. To make a remote stream work I have to loop the traffic through my phone so it looks like it is a local URL to the Samsung TV.

I probably have to run a simple proxy type of a server on the phone. The phone always knows what the stream URL is so the proxy can be very simple one that always takes any incoming request and pipes it to the video stream on the external server.

I have tried running a socket connections and simply copying the input strem from the external server to the output stream of the socket server connection. While using this a web browser is able to download the file but all the metadata is lost and I also seem to get a broken pipe exception every time the file download finishes. Media players don’t seem to understand the stream at all and there’s no playback on VLC for example.

For the server I’m using a very simple piece of code like this:

    public class ServerThread implements Runnable {

    public void run() {
        try {
            if (SERVERIP != null) {

                serverSocket = new ServerSocket(SERVERPORT);

                while (true) {
                    // listen for incoming clients
                    Socket client = serverSocket.accept();
                    client.setSoTimeout(20000);
                    client.setKeepAlive(true);


                    OutputStream os = client.getOutputStream();

                    OutputStream out = new BufferedOutputStream(os);


                    InputStream is = openHttpConnection("<URL to the stream>");

                    copyStream(is, out);

And for the copy stream code:

    private static void copyStream(InputStream input, OutputStream output)
        throws IOException {
    int bytesRead;
    try {
        while ((bytesRead = input.read()) != -1) {
            output.write(bytesRead);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

    output.flush();
    output.close();
    input.close();
}

Is there something I can do to simply forward all the metadata to the socket connection as well? Or am I doing something else wrong as well?

Are there any examples of serving video from Android phone to media players I could use to understand how to format the response stream correctly?

Thanks!!

  • 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-14T12:46:50+00:00Added an answer on June 14, 2026 at 12:46 pm

    First: Dude! Didn’t know you were here on SO! 🙂

    With the pleasantries out of the way…

    I am guessing that your problem, at least in part, is that you are only copying the HTTP payload, not the entire HTTP response from the server. Hence, you are missing the 200 OK line and any requisite headers. This assumes that the unseen openHttpConnection() is using getInputStream() on an HttpUrlConnection, or the equivalent.

    Options include:

    • Also serve getResponseCode(), getResponseMessage(), and headers reconstructed from getHeaderFields(), before serving that result stream.

    • Switch from HttpUrlConnection to just serving input from a raw socket that you use to manually make the HTTP request.

    • Find and use an existing HTTP reverse proxy engine or transparent proxy engine, such as one based off of a servlet, or perhaps one based on native code (after de-Tor-ing it, maybe)

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

Sidebar

Related Questions

I want to stream the video from android phone camera to VLC media player
I want to Send AT Command to Android phone. I know SDK does not
I want to write an application for my android phone to control it via
I want to send messages from android phone by using putty. Is that possible?
I want to send image and text data from Android phone to a Server.
i have an Android Phone, Samsung Galaxy Pop and I want my phone to
I want to display external image like: http://abc.com/image.jpg in my android phone application. can
i want to upload a file from my android phone to server URL. but
I want to send and receive messages between my Android phone and a Terminal
I have developed an application for my android phone(Samsung GT-S5830) using SDK:2.3.3. I want

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.