Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Streaming Video Through a Servlet (.wmp)  RSS feed

 
B Wiley Snyder
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I'm basically just connecting to the movie and I would like to play it through the servlet. I've gotten this far so far. I've got the movie actually opening up but it is corrupted. The movies fine with a normal browser link but I need to connect this way. Can anyone point me in the right direction please??



thanks
 
B Wiley Snyder
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is a better question. I've modified the code also. If I am just connecting to an URL through a servlet. What could be corrupting the file if it opens on its own without httpconnect . What is that adding to this situation? It connects, opens the player and I get a file corruption error. but If I go straight to the URL http://www.foo.com/MovementDemo.wmv ... it opens up just fine. I thought If I set the response object to the mime type it would open it just like it would if the url was in the address bar?

[code]
package TESTLINK;

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.net.*;

public class WindowsMediaServer extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)throws ServletException, IOException {

response.setHeader("Cache-Control","no-cache");
response.setHeader("Pragma","no-cache");
response.setDateHeader ("Expires", 0);

response.setContentType("video/x-ms-wmv");
try{
URL theUrl = new URL("http://www.foo.com/MovementDemo.wmv");
URLConnection connection = theUrl.openConnection();
HttpURLConnection http = (HttpURLConnection)connection;
http.connect();

}catch(ConnectException ce){

}

}
}

anything please, thanks
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!