Stream video and download it
-
Good day
is there a way to stream a video from online location and also save the streamed video on the device.
I've looked on quite few posts, but could not find anything clear, except for this "post":http://web.archiveorange.com/archive/v/LFNfvMaPE2IZQHvr2yq1.
Any suggestions are welcomed
Thanks!
-
Short answer is: - "Yes, there is".
If you need a little bit more information on how to do that, we need more detailed explanation from you. From which online location? How do you want to play it? Are you using Phonon or 3rd libraries? Do your libraries do the download or should you do it by yourself? Etc... -
Ok, here are the details
1- I have an mp4 video on a webserver, so the mp4 files would mostly be from personal server
2- when I say play it, I mean view the video, not sure if you mean anything else by that.
3- I would like to do it using Phonon, no 3rd party libraries
4- I would prefer to do the download myself as well.
5- if this can be for mobile phones in the first place, if not possible then for pc'sThanks
-
Subclass "QIODevice":http://qt-project.org/doc/qt-4.8/qiodevice.html and pass it to the Phonon "MediaSource":http://qt-project.org/doc/qt-4.8/phonon-mediasource.html
In your QIODevice you can also save downloaded data to the file.
-
It will work for Desktop and Mobile devices. There is an mediadownloader project on the web, for desktop and Nokia N900. It is opensource. You can take a look how does they have implemented this functionality...
-
Thanks, very good idea
I will give it a try and do it.
-
I did that "mediadownloader":https://marcobavagnoli.wordpress.com/mediadownloader-desktop/ app, but it is a bit old and since youtube chaged thing last week, it will not work as it should now. I have updated the sources lately but didn't published yet.
I reimplemented QIODevice like AcerExtensa said, but only to try to manage remote streams as if they were local files ( with a red buffer like you see on youtube while watching a video ). But it's not working very good.
With Phonon you can play remote videos using just (I remind you to the "VideoPlayer":http://qt-project.org/doc/qt-4.8/phonon-videoplayer.html doc for more):@ VideoPlayer *player = new VideoPlayer(Phonon::VideoCategory, parentWidget);
player->play(url);@To download just use "QNAM":http://qt-project.org/doc/qt-4.8/qnetworkaccessmanager.html and get it. But this is not enough if you want to play youtube videos.
cheers
-
I'm using "mediadownloader":marcobavagnoli.wordpress.com app source code as a base code, but there is one problem when using it with N8. it seems that N8 cant handle opening the same file for read/write simultaneously.
on desktop and N9 it works perfect, but with N8 or Symbian^3 in when the media@
buffer = new MBbuffer(QUrl(mediaLocation));
connect(buffer, SIGNAL(bufferEmptyed()), mediaObject, SLOT(pause()), Qt::DirectConnection );
connect(buffer, SIGNAL(bufferReady()), mediaObject, SLOT(play()), Qt::DirectConnection );
connect(buffer, SIGNAL(downloadFinished(QString)), this, SLOT(downloadFinished(QString)));mediaObject->setCurrentSource(Phonon::MediaSource(buffer));
@When the bufferReady signal is fired, and mediaobject tries to play, the "Cant determine media type" error is popped up
but if the i wait till the completion of the download and then try to play the file, it plays correctly.
This only happens with Symbian, but on N9, and desktop it works OK!Any suggestion is welcomed!
-
maybe "this YouTube video tutorial guide":http://www.youtube.com/watch?v=0srs4kJMahw&feature=youtu.be can help you.