I am using the following code to stream the videos from my server on android phone:
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(videoUrl)); // When I hit this URL in web browser on my PC, it works
startActivity(i);
When I run the code, it asks me to select a player. When I select a player, that player opens up and then nothing happens. I've even tried waiting for minutes, but the video never starts.
My question is, is it really as simple to just put the video on my webserver and on android run the above code to get that video streaming?
Do I need to make any changes on my server? Can anyone please help me with this? I cannot figure out if the problem is with my sever or client side.
It was the problem of VLC player that I was using on my Android Phone for testing. I downloaded the MX Player and tried it with that. Everything is working fine now :-)
That means not every video player on Google Play is mature enough to take a URL and start streaming the video. For that you need a good video player that supports this feature.
Related
I am using UIImagePickerController to pick videos in a messaging app. These videos can then be played back on either an iOS app, Android app or Web app. I am using the code below.
let picker = UIImagePickerController()
picker.delegate = self
picker.mediaTypes = ["public.image", "public.movie"]
picker.videoQuality = UIImagePickerControllerQualityType.typeMedium
if #available(iOS 11.0, *) {
picker.videoExportPreset = AVVideoProfileLevelH264Baseline30
}
This works fine and the video message sends and plays back fine on iOS and web but when playing back in an Android VideoView I get a "Can't play this video" message. The video is definitely being saved to the Android device in the correct location as I can pull it from there using Android Device Monitor and see that it is definitely h264 but there is something about the file the Android VideoView doesn't like.
What am I missing to make these videos picked on iOS play on an Android device? I'd really rather not transcode them on a server because that will massively slow down the message delivery time.
Thanks for your help
To answer my own question in case anyone else needs it.. The iOS file was actually a .MOV even though it was encoded with h264 and saved as .mp4.
I used the function from this post to convert the .MOV to mp4 and problem solved.
Swift - How to record video in MP4 format with UIImagePickerController?
There is a live streaming video in one of my app which is from one of the websites http://shirdisaiholidays.com/live-dharsan-3/.
I used activity starter with URI as rtsp://cam.live-s.cdn.bitgravity.com/cdn-live2-b1/_definst_/cam/live/secure/feed022/playlist.m3u8?e=0&h=ba7f5c5f6bf8a02d29f909dfa8d0c075.
It worked for some time but now it has stopped altogether. Someone said I can use video player or player with the url as source which I have also used without any success. It shows an error 702. Other apps using the same live streaming are working fine.
I am working on an application in which I have to play video stream inside my app using Media
Player in android. Its a live streaming video from CCTV, so I don't even know whether we can give Media Player a link to play video or not. Currently I am using a WebView to open the url from my app only but there is one more hurdle that this Video is only accessible from Mozilla FireFox, not from the other browser, so if the user dont have that browser it his/her device then it will not work. Thats why I am opening selection of browsers using the following code :-
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
But it will take the user to the selected browser outside the app,so I just want to know how can I resolve this to make it working.
No matter whether it can be done using Media Player or a webview but I want it within my app only, not outside my app.
Any help would be appreciable.
Thanks
I'm trying to bring an Android application to Glass, one which lets the user stream video from their camera. Whenever I try to actually start the streaming, however, I get an error back from the MediaRecorder saying, "start failed: -12". Unfortunately there's not a lot of information about that error on Android, and even less on Glass. Any help?
I found nice example with libstreaming (https://github.com/fyhertz/libstreaming) there:
Google Glass stream video to server
You could try it on your phone first.
I tried simple RTSP server(example 1) as well as streaming through Wowza server, which adds some delay.
I want to create a live-stream by using vlc on rtp, (preferably) rtsp or http protocols and I want to play this stream with android 2.3.4 based cell phone. I have tried starting from scratch and tried to advance step by step. I have created an html5 based offline streaming page, and it worked. However, I have some trouble with live streaming issues. I have noticed that live-streaming with html5 will be painful. So, I wanted to get the stream directly from vlc.exe to the media player on the phone. However, I couldn't decide what to do because vlc for android is in development right now, and couldn't find a suitable player which allows me to enter the address of the vlc server.
What should I do? Should I continue trying on html5, or should I try to find a suitable application for rtsp streaming on android? Should I try Wowza or another service? (BTW, I don't want to mess with socket stuff on the server side.)
I have solved this problem by streaming the content from vlc on rtsp from the PC and created a very basic html page which gives only a link to the rtsp stream. Then, I clicked the link from that html page using the phone (actually I can carry out this step by simply writing the ip address of the server to the streaming player on the phone also) and it forwarded me to choose an external media player to play the content. In this step, choosing any streaming media player (RealPlayer, MX Player etc.) can be used to play this content. There we go! We have a live-streaming from PC to Android :)