Chromecast media Host State errors - android

I am trying to reproduce MPEG DASH, HLS and HSS(HTTP SmoothStreaming) streams by using modified sample applications provided by Google, but for now, only DASH is working.
I use:
https://github.com/googlecast/cast-custom-receiver
and
https://github.com/googlecast/CastVideos-android
As i see here https://developers.google.com/cast/docs/player?hl=en all protocols (HSS, HLS, DASH) should work without problems.
When i try to stream HSS and HLS i get this in Sample Media Receiver HUD:
Media Element State: "Error" (or "Abort")
.
.
.
Host State: "Fatal Error: code = 1"
Does anyone know what that error represents?
Also, sometimes i get this "Fatal Error: code = 0".
//UPDATE
I get this error when i try to cast HSS:
[2648.568s] [cast.receiver.MediaManager] Load metadata error cast_receiver.js:19
and the link is :
http://video3.smoothhd.com/ondemand/Turner_Sports_PGA.ism/Manifest
//UPDATE
HLS is working now. Problem is solved by setting CORS headers.

I don't know what HSS is and we don't mention HSS as a supported protocol either, nor we claim we support "all" protocols. We have listed the supported protocols/variations in the link that you have mentioned.

Problem was with codecs... I used streams encoded with VP1 video and WMAP audio codecs, so there were many errors. That is the reason for getting all those LOAD METADATA ERRORs.
And for CORS, you can use this: https://github.com/TOMODOcom/TOMODOkorz
Works like a charm :)

Related

Casting m3u8 file from android app

I am trying to play a video on my TV using chromecasting framework provided. The approach i followed for playing a mp4 works fine. But now i have different source to play. I have a video file pointed by m3u8 file placed on my server.
So, for playing m3u8 file on TV i am using the following MediaInfo object with variants for content-type mentioned here.
The MediaObject i am returning is:`
return new MediaInfo.Builder(Uri.parse(path).toString())
.setStreamType(MediaInfo.STREAM_TYPE_LIVE)
.setContentType("videos/mp4") //need to know **what should be content-type here**
.setMetadata(movieMetadata)
.setStreamDuration(mSelectedMedia.getData().getDuration() * 1000)
.build();
Please guide me for playing m3u8 file on my chromecast or TV.
Thanks
First of all, I don't see what issue you are running into; always include that in your post so that you can get a better response. Based on the description you have provided, it seems like you are casting a playlist pointing at some files; if that is the case, you shouldn't set the stream type to live stream, instead use the buffered type (like what you would do for a simple mp4). Secondly, what receiver are you using? Your receiver should be capable of handling m3u8 playlist. If you use a Styled or the Default receiver (or use the Reference receiver from our GitHub repo, then you should be fine. Finally, make sure you are using https for the vide streams (for playlists it is required) and also that your server supports CORS headers.
As suggested by #naddaf problem was with CORS. So, i simply added my domains (gstatic.com and one more in my case) on server from where i am getting requests for my media. And it all started working perfectly.

Android videoview random java.io.FileNotFoundException: No content provider

I have a videoView and loading video's from a remote server.
I'm getting random error as per below.
Problem is, it works sometimes and sometimes it doesn't.
videoView.setVideoURI(Uri.parse(Constants.API_IMAGE_HOST + "ads/video/" + this.adVideoObject.ad_videos_id + ".mp4"));
the error i get is:
MediaPlayer﹕ setDataSource IOException happend :
java.io.FileNotFoundException: No content provider:
Again, I get it sometimes but not always.
Ok, as I have mentioned in numerous other posts about VideoView, DONT USE IT! I am a professional Android developer that develops apps that are all about video playback and in my experience, VideoView is entirely unreliable and is very difficult if not impossible to get it to behave correctly across multiple devices. I would strongly suggest for you to look into the ExoPlayer library if playback is at all important to your app. It is harder to setup but the performance and reliability improvements are soo worth it.
I apologize that this does not explicitly answer your question. However I believe that you will find the ExoPlayer library a pure joy to work with over VideoView or MediaPlayer.
The error
D/MediaPlayer: setDataSource IOException | SecurityException happend :
java.io.FileNotFoundException: No content provider: http://192.168.1.114:1376/%25/F885C5CE27F16C4D64588D48A3001A1B/9.mp4
at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1137)
at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:988)
at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:911)
at android.media.MediaPlayer.attemptDataSource(MediaPlayer.java:1102)
at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1093)
Is part of the normal flow of the VideoView setDataSource. It tries to open the file locally, and then moves onto loading remotely.
Typically there will be a further error message which explains the actual failure.
In my case, it was getDuration being called in the incorrect state. So look further down the logs, and check that you are following the state diagram in the documents and ensuring that the API is called only when the view is in the correct state

Hardware video decoding on Android using GStreamer

I have to implement a GStreamer pipeline on Android which will get a live mpegts stream from a mpegts server on a linux machine(also implemented through GStreamer).
Now, I have a Samdung Galaxy Tab2, 5113, which has Android-4.1.2-JellyBean and API level=16
My receiver pipeline is as follows:
data->pipeline = gst_parse_launch("udpsrc caps=\"video/mpegts, systemstream=true, packet-size=188\" ! tsdemux ! queue ! h264parse ! amcviddec-omxgoogleh264decoder ! eglglessink", &error);
This as per Android-Tutorial-3 of GStreamerSDK.
When I press the play button,
I get this error:
06-26 00:04:56.927: D/GStreamer+tutorial-3(7201): 0:00:05.920807000 0x5a65c320 jni/tutorial-3.c:88:set_ui_message Setting message to: Error received from element amcvideodec-omxgoogleh264decoder0: GStreamer encountered a general supporting library error.
A more detailed log of the application as shown on the logcat of the Eclipse IDE:http://pastebin.com/EX8sgcEp
So it seems that the amcviddec-omxgoogleh264decoder element cannot dequeue the input data as well as GStreamer encounters a library error.
I would appreciate any help or suggestions.
We had solved the problem some time back.
Just putting it here for any body else's reference.
The problem was, if we are to use amcviddec-omxgoogleh264decoder, there are some dependent files which need to be installed besides the gstreamer application. Don't knopw exactly what they were.
Anyways, if one sees the /etc/media-codec.xml file in the android root, we will get to know all the multimedia codecs supported by one's android device. This includes the codec supported by hardware codec chips also.
For us, we tried the amcviddec-omxtiducati1videodecoder, and it worked like a charm.
Regards,
Yusuf Husainy.

AudioPolicyManagerBase error

My LogCat contains the following line multiple times:
08-01 09:15:03.101: ERROR/AudioPolicyManagerBase(95): unknown stream type
Is this an actual error in my app or something to ignore?
Are you using AndEngine or any 2d-3d engine? If so, there's the answer. They usually internally set the audio stream as STREAM_MUSIC.
If you are using a Media object, are you releasing it?
Are you streaming any audio extension that the standard Android music player cannot play?
Anyway put some code and tell us what your application is intended to do so we can provide a better answer :)

Making Video files Android ready for playback over HTTP

I am working on an Android application which is supposed to play videos over HTTP on Android devices. Before we setup a server to host the video files just wanted a few things clarified:
As per the developer documentation, Android supports .mp4 and .3gp container formats for video. If we use H.263(video) - AAC LC (Audio) audio-video codec used for our media files will we be able to play the video by passing the URL to MediaPlayer class?
I did a little experiment and passed URL of one of the video files(.mp4) to the MediaPlayer class and got the following error:
Command PLAYER_INIT completed with an
error or info
PVMFErrContentInvalidForProgressivePlayback
From the docs, I came to know that for progressive playback, the video's index (e.g moov atom) should be at the start of the file.
Questions:
1. How do we make our videos Android-ready?
2. What are the different considerations that we need to make?
Please help.
Thanks.
You can actually achieve this using a pure Java implementation of ISO BMF ( MP4 ) container used JCodec ( http://jcodec.org ). For this use the following code:
MovieBox movie = MP4Util.createRefMovie(new File("bad.mp4"));
new Flattern().flattern(movie, new File("good.mp4"));
The side effect of 'Flattern' is creating a web optimized movie file that has it's header BEFORE the data.
You can also use similar functionality from command line:
java -cp jcodec-0.1.3-uberjar.jar org.jcodec.movtool.WebOptimize <movie>
The JCodec library can be downloaded from a project website.
I cross posted this question on Android-developers google group. Mark answered it there. Thanks Mark!
See this thread

Categories

Resources