Chromecast MediaInfo.Builder can't play shoutcast - chromecast

I have one problem regarding MediaInfo.Builder of Google Cast. I used following code:
MediaInfo mediaInfo = new MediaInfo.Builder("http://shoutcast2.index.uz.zgora.pl:8000")
.setStreamType(MediaInfo.STREAM_TYPE_LIVE)
.setContentType("audio/mpeg")
.build();
But Cast player is not working at all. The reason is, that URL leads to SHOUTCAST. Apparently, the problem is in content type. Could somebody advise which contentType to use for shoutcast streams, or at least provide some workaround for this?
Thank you.

Instead of http://shoutcast2.index.uz.zgora.pl:8000/, use http://shoutcast2.index.uz.zgora.pl:8000/;. Note the semicolon on the end.
SHOUTcast servers are going to look for Mozilla in the User-Agent request header, as a way of detecting a browser vs. a media player. If the server thinks the client is a browser, it will send the admin page rather than the stream. By passing ; in the request URI, the SHOUTcast server will use the user agent string of MPEG OVERRIDE and will send the actual stream data.
You should also know that SHOUTcast isn't truly HTTP compatible. It's close enough that it will probably work, but may stop working in the future. Icecast is one of several better alternatives.

Brad's solution worked for me. Just added a slash and a semicolon after the port. I also changed the content type from audio/mpeg to audio/mp3. My working code looks like this.
MediaInfo mediaInfo = new MediaInfo.Builder("http://shoutcast2.index.uz.zgora.pl:8000/;")
.setStreamType(MediaInfo.STREAM_TYPE_LIVE)
.setContentType("audio/mp3")
.build();

Related

How do I test a webm videostream using jmeter?

AFAIK there are 2 video streaming plugins available for JMeter:
BlazeMeter - HLS Plugin and
UbikLoadPack Video Streaming plugin
UbikLoadPack as a prohibitive pricing tag and HLS Plugin doesn't test the format I need. Also I want a FOSS solution not a paid one.
Does anyone know of some other plugin or method I could test a webm video stream ?
Edit
#dmitri-t when I try to do this it just hangs. Here I found this script that shows how to test a video. But when I changed the parameters to my video and range to 0-100 it hanged.
Also the example is using HTTP and my video uses HTTPS.
Tried to include a timer. It hangs also.
Yet the video loads perfectly in Chrome with the same url I used in Jmeter.
I also tested the request with Postman. It ignores the range header. So what's probably happening in JMeter is that it's trying to load the whole continuous stream. How do I make it consider range header ?
I tested with Postman on an image in the same server to see if range header was being considered or if it was a server problem and range was respected correctly.
Content-Range header doesn't work also. Please check this related question I did relative to the range problem with streams: Request to a webm stream ignores range header
I don't think you need any form of plugin, you can simulate the browser playing the video using normal HTTP Request sampler sending simple HTTP GET request
Here is the evidence that "playing" an webm "stream" is nothing more than downloading it.
It would be a good idea to add Timers to simulate users watching the video till the end (or according to your test case)

Chromecast new Cast.Api()

I just started using Chromecast SDK today and got bit confused with its APIs and samples given in the web.
What I am trying to do is to send some messages to the Chromecast so it will display them on the big screen. I am going to use Chrome API with HTML5/JS/CSS.
Most examples (https://github.com/pjjanak/chromecast-hello-world/blob/master/sender/index.html , http://nerdwin15.com/2013/10/chromecast-development-part-one-chrome-sender/) in the web uses new Cast.Api() in the sender and uses an Activity in doing so. But I could not find a reference to a Cast.Api in the Chrome API. Most Google references deal with Media and I am not sure whether I have to use them. So to sum up, following are the questions I have (Sorry! I did read the API and developer guide but I am still clueless).
Do I have to write a custom receiver to show text on TV screen. Can't I survive default receiver, chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID
Is handling multimedia files different from displaying text on the Chromecast or can I set the mime type to text/html and send a text stream (doesn't work for me at the moment)
Are those examples on the web uses a deprecated way of sending data to chromecast?
Thanks in advance,
Ish
Ok I think I found the answer from following documents,
https://developers.google.com/cast/docs/receiver_apps
https://github.com/googlecast/CastHelloText-chrome/blob/master/chromehellotext.html
Will try them and let you all know!
Following example page is very useful for anyone who try writing chromecast apps
https://github.com/googlecast
I'm not sure how you fared, but here are some quick responses to your questions.
Yes, you have to write a custom receiver if you want to do anything other than sending images, audio, or video to the Chromecast. You can see a list of supported media Default Media Receiver here: https://developers.google.com/cast/docs/media
Yes (see above), it requires a custom receiver, which will also require your own appId and I'm pretty sure a custom namespace.
To my knowledge, all of the examples up on https://github.com/googlecast should be relevant, but I am working on a few wrappers to try to simplify getting up and running with custom Chrome Sender and Receiver apps. You can check them out here: https://github.com/googlecast Let me know if those help, and if you have any feedback to share.
I hope you've already figured all this stuff out, but if not hopefully this is useful.

Chromecast testing for playable content receiver side

In the javascript api for HTML5 video there is a canPlayType method to check if something is playable or not. However I've noticed that on the Chromecast this function doesn't quite cover everything. On several occasions playing local content with the app I'm working on I'll get an error saying that it is not playable, but if I take off my error checking which uses canPlayType then I have no issues. I'm curious if anyone has nailed down a good way to figure out supported content other than simply checking strings against a list that we create using the supported media types from https://developers.google.com/cast/supported_media_types
The response to HTMLMediaElement.canPlayType()is supposed to be accurate and reliable. If you see any inaccuracy there on Chromecast devices, please file a bug with the appropriate information, thanks.

Windows Phone 7 ASX Streaming

I'm trying a small app which play a asx streaming file. My understanding was i should parse the asx and get the URL. But in my case, REFHREF in ASX points like this www.website.com:8084. Is this the server configuration need to be modified ? Totally new to this audio streaming protocols. Any suggestion would be much appreacited ...
My code streams audio fine when i test with a ww.website.com/file.MP3
the URL from refhref may most probably lead you to another asx file, which needs to be parsed again, i would advice recursively parsing till u reach a valid playable stream! Wp7 supports asx streams but it disallows(throws an exception for some tags check here )
so you will have to parse the asx yourself, extract the URL and process it further!
Good Luck! post your findings too!

How could I download an mms audio stream in Ruby?

I would like to access an mms:// url, and stream the file in ruby. For example,
in the same way that Net:HTTP works for http:// type urls.
The simpliest (but non-scalable) way is to ask MPlayer to -dumpstream it for you.
http://mplayerhq.hu/

Resources