SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Customizations

Notices

SageTV Customizations This forums is for discussing and sharing user-created modifications for the SageTV application created by using the SageTV Studio or through the use of external plugins. Use this forum to discuss customizations for SageTV version 6 and earlier, or for the SageTV3 UI.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-13-2010, 12:40 PM
jrjbertram jrjbertram is offline
Sage User
 
Join Date: Feb 2009
Posts: 39
webserver + vlc + android + streaming = error

I have Nielm's Webserver V2.25 installed on top of SageTV 6.6 (pretty sure) and have VLC 1.05 installed in order to get streaming media.

Works great from my PC (localhost and laptop on my LAN). The webserver works great from my android phone. Streaming works great from my LAN. Streaming even works great from a Windows PC outside my LAN (ie, from work).

Streaming from an android phone (a Droid) does not work (from LAN or from 3G connection).

It seems to be a problem with the download of the playlist, though, not from video encoding settings.

From the phone, I can navigate to one of my recordings, I can select streaming, and I can select one of the encodings (doesn't matter which). When I click on one of the 'Play in External Player' links, the phone's browser wants to save the playlist file as a downloaded file ("PlaylistGenerator.m3u" for example) but when the phone tries to download, the browser gets an error:

"Cannot download. The size of the item cannot be determined."

I can't find any useful information googling for the error... am not sure if it's an issue with the phone's browser or something with the web browser. (The browser can stream video from YouTube, and I've been able to set up Darwin streaming media server and successfully stream videos to my phone over RTSP if I get the video encoded correctly with HandBrake).

I think that maybe the webserver on the download of the playlist is perhaps not including the size of the playlist when it is downloaded. Does that sound reasonable? Maybe a missing/unsupported HTTP header or something?

I've been poking through the webserver's config files and don't see anything that looks like I can configure this option. Wondering if anyone's been down this road and figured it out already..?

Thanks much,
- Josh.
Reply With Quote
  #2  
Old 03-13-2010, 10:26 PM
jrjbertram jrjbertram is offline
Sage User
 
Join Date: Feb 2009
Posts: 39
wireshark traces

Here's what I see on wireshark for one of the files that are downloaded normally as part of the page reload. Note the "Content-Length" HTTP header in the response.

Code:
  
  GET /sage/menu_items.js HTTP/1.1
  Host: 192.168.1.198:8080
  User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.8) Gecko/20100202 Firefox/3.5.8 (.NET CLR 3.5.30729)
  Accept: */*
  Accept-Language: en-us,en;q=0.5
  Accept-Encoding: gzip,deflate
  Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
  Keep-Alive: 300
  Connection: keep-alive
  Referer: http://192.168.1.198:8080/sage/Detai...aFileId=300316
  If-Modified-Since: Wed, 15 Jul 2009 04:29:52 GMT
  Authorization: Basic anJqYmVydHJhbTpncmV0Y2h5
  Cache-Control: max-age=0
  
  HTTP/1.1 304 Not modified
  Date: Sun, 14 Mar 2010 04:16:14 GMT
  MIME-Version: 1.0
  Server: Rogatkin's JWS based on Acme.Serve/$Revision: 1.26 $
  Last-modified: Wed, 15 Jul 2009 04:29:52 GMT
  Connection: close
  Content-Type: application/x-javascript
  Content-Length: 6381
Here's what I see when I click on the playlist generator links. Note no Content-Length header. Can that header be added to however PlaylistGenerator works? I suspect this would fix my android browser problem.

Code:
GET /sagepublic/PlaylistGenerator?Command=generate&pltype=wvx&fntype=url&MediaFileId=300316&TranscodeOpts=mode%3Dvlc%26vc%3Dh264%26vb%3D192%26ac%3Dmp3%26ab%3D64%26scale%3D0.3%26mux%3Dts%26deint%3D1 HTTP/1.1
Host: 192.168.1.198:8080
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.8) Gecko/20100202 Firefox/3.5.8 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://192.168.1.198:8080/sage/Detai...aFileId=300316

HTTP/1.1 200 Ok
Date: Sun, 14 Mar 2010 04:12:20 GMT
Content-Disposition: attachment; filename=playlist.wvx
Content-Encoding: gzip
MIME-Version: 1.0
Server: Rogatkin's JWS based on Acme.Serve/$Revision: 1.26 $
Connection: close
Content-Type: video/x-ms-wvx

<binary data>
Reply With Quote
  #3  
Old 03-13-2010, 11:10 PM
jrjbertram jrjbertram is offline
Sage User
 
Join Date: Feb 2009
Posts: 39
maybe just a browser bug - out of luck..?

I don't see anything in 4.3 or 4.4 of:

http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html

...that makes me think that Content-Length is required. Guessing that android is a little too strict?

- J.
Reply With Quote
  #4  
Old 03-14-2010, 12:22 AM
jrjbertram jrjbertram is offline
Sage User
 
Join Date: Feb 2009
Posts: 39
nevermind

Ended up finding:
http://forums.sagetv.com/forums/showthread.php?t=44680

Converting to Jetty / new webserver app fixed the Content-Length issue. New issues, but I'll start another thread for that.
Reply With Quote
  #5  
Old 03-14-2010, 10:14 PM
jreichen's Avatar
jreichen jreichen is offline
Sage Icon
 
Join Date: Jul 2004
Posts: 1,192
Quote:
Originally Posted by jrjbertram View Post
Ended up finding:
http://forums.sagetv.com/forums/showthread.php?t=44680

Converting to Jetty / new webserver app fixed the Content-Length issue. New issues, but I'll start another thread for that.
I see in your wireshark log that the response is being gzipped. Jetty's gzip filter is apparently handling the Content-Length header better than TJWS does.
__________________
Server: Intel Core i5 760 Quad, Gigabyte GA-H57M-USB3, 4GB RAM, Gigabyte GeForce 210, 120GB SSD (OS), 1TB SATA, HD HomeRun.
Extender: STP-HD300, Harmony 550 Remote,
Netgear MCA1001 Ethernet over Coax.
SageTV: SageTV Server 7.1.8 on Ubuntu Linux 11.04, SageTV Placeshifter for Mac 6.6.2, SageTV Client 7.0.15 for Windows, Linux Placeshifter 7.1.8 on Server and Client
, Java 1.6.
Plugins: Jetty, Nielm's Web Server, Mobile Web Interface.

Reply With Quote
  #6  
Old 03-14-2010, 09:17 AM
jrjbertram jrjbertram is offline
Sage User
 
Join Date: Feb 2009
Posts: 39
Jetty webserver + vlc + android + streaming = error

I have the Jetty webserver installed on top of SageTV 6.6 (pretty sure) and have VLC 1.05 installed in order to get streaming media.

(Installed Jetty per http://forums.sagetv.com/forums/showthread.php?t=44680. Used nielm_websrv_jetty_2_x.zip.)

Works great from my PC (localhost and laptop on my LAN). The webserver works great from my android phone. Streaming works great from my LAN. Streaming even works great from a Windows PC outside my LAN (ie, from work).

Streaming from an android phone (a Droid) does not work (from LAN or from 3G connection).

It seems to be a problem with the download of the playlist, though, not from video encoding settings.

From the phone, I can navigate to one of my recordings, I can select streaming, and I can select one of the encodings (doesn't matter which). When I click on one of the 'Play in External Player' links, the phone's browser wants to save the playlist file as a downloaded file ("PlaylistGenerator.html").

The phone downloads the file as an HTML file to its temporary downloads, but it seems to have lost track that it's actually a playlist file extension -- I can't get it to save as anything other than HTML, so I don't think there's a way for another program / browser plugin to play it.


Note: This thread was spawned from... once I switched to Jetty, I got farther.
http://forums.sagetv.com/forums/showthread.php?t=47384
Reply With Quote
  #7  
Old 03-14-2010, 10:21 PM
jreichen's Avatar
jreichen jreichen is offline
Sage Icon
 
Join Date: Jul 2004
Posts: 1,192
Quote:
Originally Posted by jrjbertram View Post
It seems to be a problem with the download of the playlist, though, not from video encoding settings.

From the phone, I can navigate to one of my recordings, I can select streaming, and I can select one of the encodings (doesn't matter which). When I click on one of the 'Play in External Player' links, the phone's browser wants to save the playlist file as a downloaded file ("PlaylistGenerator.html").

The phone downloads the file as an HTML file to its temporary downloads, but it seems to have lost track that it's actually a playlist file extension -- I can't get it to save as anything other than HTML, so I don't think there's a way for another program / browser plugin to play it.
Take a look at the response headers and see if they contain a Content-Type. When I click on an m3u playlist, the content type is audio/x-mpegurl. The iPhone just returns back to the page after clicking on the link but I haven't looked up its officially supported playlist types.

If your content type is wrong, check out this wiki page and see if you can get the results you want: http://tools.assembla.com/sageplugin...ustomMimeTypes.
__________________
Server: Intel Core i5 760 Quad, Gigabyte GA-H57M-USB3, 4GB RAM, Gigabyte GeForce 210, 120GB SSD (OS), 1TB SATA, HD HomeRun.
Extender: STP-HD300, Harmony 550 Remote,
Netgear MCA1001 Ethernet over Coax.
SageTV: SageTV Server 7.1.8 on Ubuntu Linux 11.04, SageTV Placeshifter for Mac 6.6.2, SageTV Client 7.0.15 for Windows, Linux Placeshifter 7.1.8 on Server and Client
, Java 1.6.
Plugins: Jetty, Nielm's Web Server, Mobile Web Interface.

Reply With Quote
  #8  
Old 03-19-2010, 09:10 PM
jrjbertram jrjbertram is offline
Sage User
 
Join Date: Feb 2009
Posts: 39
I've been looking into the mime.types suggestion you'd made, but can't seem to get it to work. I'm currently getting back the following:

Code:
GET /sage/public/MediaFile?MediaFileId=315951&Segment=0 HTTP/1.1
Host: --edit--:--edit--
Accept-Encoding: gzip
Referer: http://--edit--/sage/DetailedInfo?MediaFileId=315951
Accept-Language: en-US
User-Agent: Mozilla/5.0 (Linux; U; Android 2.0.1; en-us; Droid Build/ESD56) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17
Cookie: grid_num_hours=6; grid_num_chans=999
Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Charset: utf-8, iso-8859-1, utf-16, *;q=0.7

HTTP/1.1 200 OK
Date: Sat, 20 Mar 2010 02:35:25 GMT
Content-Length: 1903091
Last-Modified: Mon, 15 Mar 2010 15:00:25 GMT
Accept-Ranges: bytes
Content-Range: bytes 0-1903090/1903091
Content-Disposition: attachment; filename=Make-MusicMachines-42109-0.mp4
Server: Jetty(6.1.19)
Content-Type is missing as you suggested.

When I look at a random sample mpeg I found on the internet, I see:

Code:
GET /downloads/tomb.raider.sample.mpg HTTP/1.1
Host: www.kvcd.net
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.1.249.1036 Safari/532.5
Referer: http://kvcd.net/portal/articles.php?lng=en&pg=60
Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3

HTTP/1.1 200 OK
Date: Sat, 20 Mar 2010 01:43:34 GMT
Server: Apache/2.2.14 (Unix) mod_ssl/2.2.14 OpenSSL/0.9.8l DAV/2 mod_auth_passthrough/2.1 FrontPage/5.0.2.2635
Last-Modified: Tue, 23 Nov 2004 08:10:04 GMT
ETag: "ae504da-999048-3e9888017cf00"
Accept-Ranges: bytes
Content-Length: 10063944
Keep-Alive: timeout=10, max=30
Connection: Keep-Alive
Content-Type: video/mpeg
The random internet download downloads as an mpeg file, and is recognized by the media player on the phone (but won't play due to wrong encoding, probably).

Followed directions at:
http://tools.assembla.com/sageplugin...ustomMimeTypes

1) Created SageTV/SageTV/jetty/user/mime.types
2) Created the Set directive you describe (copied & pasted) in SageTV/SageTV/jetty/contexts/nielm_websrv.context.xml
2) Put random garbage into the mime.types file (wasn't sure what the file format should be) to verify I had the right path -- was assuming I'd get a failure or jetty page load failure, but got no change. Random garbage currently is:

Code:
sadfasdfjsd


asdlkfjasdf
Googling, I came found Jetty documentation about setting mime types directly in the webdefault.xml file. For ex:
http://docs.codehaus.org/display/JETTY/webdefault.xml
http://account.pacip.com/jetty/doc/MimeTypes.html
http://forums.atlassian.com/thread.j...503&#257257503

Tried adding in the following to SageTV/SageTV/jetty/etc/webdefault.xml:
Code:
  <!-- ==================================================================== -->
  <!-- Default MIME mappings                                                -->
  <!-- The default MIME mappings are provided by the mime.properties        -->
  <!-- resource in the org.mortbay.jetty.jar file.  Additional or modified  -->
  <!-- mappings may be specified here                                       -->
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  -->
  <!-- UNCOMMENT TO ACTIVATE
  <mime-mapping>
    <extension>mysuffix</extension>
    <mime-type>mymime/type</mime-type>
  </mime-mapping>
  -->
  <mime-mapping>
    <extension>mp4</extension>
    <mime-type>video/mpeg</mime-type>
  </mime-mapping>
Replaced my garbage text in mime.types with (for lack of a better idea):
Code:
  <mime-mapping>
    <extension>mp4</extension>
    <mime-type>video/mpeg</mime-type>
  </mime-mapping>
The file I'm downloading is named "F:\sage recordings\Make-blahblah.mp4" as displayed in the sage web interface.

(Note, I don't think it matters, but this is a converted file that's 3 seconds in length which was encoded with 'iPod-Fair Quality'. I don't think this encoding will work on my Droid, but was going to figure that out after I got the file to download correctly.)

What am I missing?

Thanks
- J.
Reply With Quote
  #9  
Old 03-19-2010, 09:33 PM
jrjbertram jrjbertram is offline
Sage User
 
Join Date: Feb 2009
Posts: 39
original file works...

Hmm.. of course as soon as I hit send, I get some success..

If I go back to the original file (an *.mpg) I get the right content type:

Code:
GET /sage/public/MediaFile?MediaFileId=310403&Segment=0 HTTP/1.1
Host: --edit--:--edit--
Accept-Encoding: gzip
Referer: http://--edit--/sage/DetailedInfo?MediaFileId=310403
Accept-Language: en-US
User-Agent: Mozilla/5.0 (Linux; U; Android 2.0.1; en-us; Droid Build/ESD56) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17
Cookie: grid_num_hours=6; grid_num_chans=999
Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Charset: utf-8, iso-8859-1, utf-16, *;q=0.7

HTTP/1.1 200 OK
Date: Sat, 20 Mar 2010 03:29:23 GMT
Content-Type: video/mpeg
Content-Length: 807550976
Last-Modified: Mon, 15 Mar 2010 15:30:00 GMT
Accept-Ranges: bytes
Content-Range: bytes 0-807550975/807550976
Content-Disposition: attachment; filename=Make-MusicMachines-42109-0.mpg
Server: Jetty(6.1.19)
So I guess by default somewhere Jetty knows how to handle mpg files but not mp4, and whatever I was doing didn't work for the new file type.

I'll go down the route of trying to convert to a format that'll work on the droid and see how far that gets me.

- J.
Reply With Quote
  #10  
Old 03-20-2010, 09:09 AM
jrjbertram jrjbertram is offline
Sage User
 
Join Date: Feb 2009
Posts: 39
surgery

Sooo.. finally got this working with brute force, but would like to figure out the "right" way.

Details included for anyone interested.

So I dug around in the jetty jar file and found mime.properties. It has a format like:

Code:
mp2	= audio/mpeg
mp3	= audio/mpeg
mpeg	= video/mpeg
mpe	= video/mpeg
mpga	= audio/mpeg
mpg	= video/mpeg
I tried inserting something in this format for mp4 in my mime.types file, but no dice.

Soooo... I used the Java 'jar' tool to extract jetty's jar file into a temp directory (ie, 'jar -xf jetty[vernum].jar', then modified mime.properties directly inserting:

Code:
mp4	= video/mpeg
Then used jar tool to re-create the jar file ('jar -cf jetty_test.jar org META-INF') with my modified mime.properties.

Clicking on the mp4 files now more or less works. The mime type is correctly set to video/mpeg, and the phone will now download the files as *.mpeg.

(Android phones seem to be particular on their file extensions -- I tried overriding the file on the save as <file>.mp4, but it saved it as <file>.mpeg anyway... whatever..)

In any case, the file extension didn't matter.. the built in android media player was able to play the file with an mpeg file extension. For the Droid users out there, this sort of surprised me, but the iPod-Fair Quality convert setting worked on the Droid. I haven't looked at the encoder settings, but this apparently must be one of the supported codecs on Droid.

So this works pretty well if you're willing to convert files for testing, but requires that you completely download the file before playing it. I was using converted files that were 3 seconds in length, and that was maybe 500KB download depending on the file.

I think the next step is determining why the playlists are also being saved as HTML files, rather than as playlist files. Probably a mime type issue as well???

If I get the playlist issue figured out, then I believe that streaming to Droids (and possibly all Androids) should work?

- J.
Reply With Quote
Reply

Tags
android, error, jetty, streaming, transcode, vlc, webserver


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Webserver Java Error bialio SageTV Customizations 5 12-07-2007 06:56 PM
Nielm Webserver streaming issue kck SageTV Customizations 1 07-09-2007 11:30 AM
VLC Player Can Play iso DVD images -- How to Make SageTV Use VLC? bbkim SageTV Customizations 3 06-07-2007 05:24 PM
No sound on DVB-T recordings using Webserver 2.6 and VLC Grunter SageTV Customizations 0 03-24-2006 11:56 PM


All times are GMT -6. The time now is 02:38 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.