Results 1 to 5 of 5

Thread: phonon VideoPlayer seek

  1. #1
    Join Date
    May 2008
    Location
    Melbourne, Australia
    Posts
    136
    Thanks
    9
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default phonon VideoPlayer seek

    hello,

    I am trying to load a video with VideoPlayer and start playing from a
    certain point. Here is the relevant code:

    video = new Phonon::VideoPlayer(Phonon::VideoCategory);
    video->play(Phonon::MediaSource(filename));
    video->seek(frame);

    However the seek here is ignored and the video will always plays from the start.
    If I try seeking at other times it does work, so does that mean I can only seek in an already loaded video? If so, how do I detect when the video is loaded? - VideoPlayer does not send any useful signals

    Richard

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: phonon VideoPlayer seek

    Note that the backend is free to ignore the seek request if the media source isn't seekable
    The source won't be seekable until its frame index is fully loaded which probably takes a second or so. I suggest you connect to MediaObject::seekableChanged() signal and when it fires, seek to the proper place.

  3. The following user says thank you to wysota for this useful post:

    rbp (30th October 2008)

  4. #3
    Join Date
    May 2008
    Location
    Melbourne, Australia
    Posts
    136
    Thanks
    9
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: phonon VideoPlayer seek

    Thanks wysota, I didn't notice the MediaSource signals.
    I saw that part you quoted in the documentation but assumed it was referring to certain file types not being seekable.

    Richard
    Last edited by rbp; 30th October 2008 at 23:49.

  5. #4
    Join Date
    May 2008
    Location
    Melbourne, Australia
    Posts
    136
    Thanks
    9
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: phonon VideoPlayer seek

    strangely I'm getting an error when connecting the signal:

    Qt Code:
    1. connect(video->mediaObject(), SIGNAL(seekableChanged(bool)), this, SLOT(seekAnimation(bool)));
    To copy to clipboard, switch view to plain text mode 

    error C2664: 'bool QObject::connect(const QObject *,const char *,const QObject *,const char *,Qt::ConnectionType)' : cannot convert parameter 1 from 'Phonon::MediaObject *' to 'const QObject *'
    Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

    MediaObject inherits from QOjbect and I've seen examples around the internet using just this syntax.
    Can you see why? If it matters, I'm using VS2008 and Qt 4.4.2.
    Last edited by rbp; 31st October 2008 at 00:16.

  6. #5
    Join Date
    May 2008
    Location
    Melbourne, Australia
    Posts
    136
    Thanks
    9
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: phonon VideoPlayer seek

    I tried including the header and now it all works:
    Qt Code:
    1. #include <phonon/mediaobject.h>
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. I cannot run the phonon demos in the PXA270!Can someone help me?
    By Justin_W in forum Qt for Embedded and Mobile
    Replies: 8
    Last Post: 19th February 2010, 10:14
  2. QSqlQuery and seek() - doesn't work on first call.
    By amicitas in forum Qt Programming
    Replies: 1
    Last Post: 2nd October 2008, 17:25

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.