qmediaplay - Does not play video files consistently, some not at all

783 views
Skip to first unread message

Bert Mariani

unread,
Jun 9, 2016, 11:49:56 AM6/9/16
to The Ring Programming Language
Hi Mahmoud

The qmediaplay does not play consistently for some video formats, not at all for other formats
Is there anything that can be done ?
Are there any codex's that need to be updated in the qmedia player

Attached is an example  "drop.avi"  which does play with VLC player.

Some "avi" play ok, Some do not
mpg  plays  ok
mkv  does not play
mp4  does not play

---------------------------------------------------

Load "guilib.ring"

new qapp {
        win1 = new qMainWindow() {

            setwindowtitle("PlayVideo!")
                    setgeometry(300,400,600,400)

            videowidget = new qvideowidget(win1) {
                setGeometry(10,10,600,300)
                setstylesheet("background-color: black")
            }

            q1 = new qpushbutton(win1) {
                 setgeometry(50,50,100,30)
                 settext("PlayVideo")
                 setclickevent("player.play() ")
                 show()
            }

            show()
        }

        player = new qmediaplayer() {

               setmedia(new qurl("/Users/umariani/Videos/GaryUSBondsQuarterToThree.avi"))  << Video ok,  Sound ok
               #setmedia(new qurl("/Users/umariani/Videos/3.mpg"))  << Video ok, Sound ok
               #setmedia(new qurl("/Users/umariani/Videos/LaoShuAiDaMi.avi"))  << Video none.  Sound ok.  No error code
               #setmedia(new qurl("/Users/umariani/Videos/Candyman.mp4"))   << Video none, Sound none.  Error code 80040266

               setvideooutput(videowidget)
               setposition(1*60*1000)

        }

    exec()

}

----------------------------

Candyman.mp4
    DirectShowPlayerService::doRender: Unresolved error code 80040266

drop.avi
    DirectShowPlayerService::doRender: Unresolved error code 80040266

drop.avi

CalmoSoft

unread,
Jun 9, 2016, 12:14:55 PM6/9/16
to The Ring Programming Language
Hello Bert,

Maybe the next link will be useful for you.


Greetings,
Gal Zsolt
(~ CalmoSoft ~)

Bert Mariani

unread,
Jun 9, 2016, 2:03:44 PM6/9/16
to The Ring Programming Language
Hi Gal. Mahmoud

I tried attaching 3 video files that you can use with the  attached Ring program:
All 3 are "avi" type. (But they exceed size that can be posted . So  Links are shown )
They show the different behavior in "qmediaplayer"
 
Windows Media Player and VLC program can play all of them properly.

  --  AA-PlayMovieShort3.ring               ==>  Use this Ring program with the attached "avi" 

   -- GaryUSBondsQuarterToThree.avi    ==>  Good video, Good sound   -- https://www.youtube.com/watch?v=hoopfp5iaKw
   -- LaoShuAiDaMi.avi                          ==>  NO video,    Good sound      https://www.youtube.com/watch?v=-k6i4o43S5M
   -- drop.avi                                         ==>  NO video ,   NO sound     -- https://www.youtube.com/watch?v=l4JZ1AZv0_c
AA-PlayMovieShort3.ring

CalmoSoft

unread,
Jun 9, 2016, 4:25:48 PM6/9/16
to The Ring Programming Language
Hello Bert,

Maybe I am not right but try the next.
Copy the media files to the directory where is your program and run the attached program.

load "guilib.ring"

new qapp {
         win1 = new qmainwindow() {
                setwindowtitle("playvideo!")
                setgeometry(300,400,600,400)
                videowidget = new qvideowidget(win1) {
                setgeometry(10,10,600,300)
                setstylesheet("background-color: black")
         }
         q1 = new qpushbutton(win1) {
              setgeometry(50,50,100,30)
              settext("playvideo")
              setclickevent("player.play() ")
              show()
         }
         show()
         }

         player = new qmediaplayer() {
                                       setmedia(new qurl("garyusbondsquartertothree.avi"))
                  #setmedia(new qurl("laoshuaidami.avi"))
                  #setmedia(new qurl("candyman.mp4"))
          #setmedia(new qurl("drop.avi"))
          #setmedia(new qurl("melekalikimaka.mp4"))
                  setvideooutput(videowidget)
                  setposition(1*60*1000)
                }
         exec()
         }

Greetings,
AA-PlayMovieShort3.ring

Bert Mariani

unread,
Jun 9, 2016, 8:19:10 PM6/9/16
to The Ring Programming Language
Hi Gal

Same problems even when the video files are placed in the RING/bin directory.
Please try it with some AVI files, and MP4 files of your own choice.

Thanks
Bert Mariani


On Thursday, June 9, 2016 at 11:49:56 AM UTC-4, Bert Mariani wrote:

Mahmoud Fayed

unread,
Jun 9, 2016, 8:20:01 PM6/9/16
to The Ring Programming Language
Hello Bert and Gal

Nice question and ideas

(1) If you can't run the video you must get the error message, if you don't get the error message then the problem is related to the file path

on my system when i use a file in the same folder, i type the name directly
If i need to write a complete path i use file:/// before the path

Example
setmedia(new qurl("drop.avi"))  
or
setmedia(new qurl("file:///C:/Users/Mahmoud/Desktop/Notes/Ring/bin/drop.avi"))

(2) Download : K-Lite Codec Pack

(3) Don't use setposition() method to move the playing to a position outside the video range 
Doing so force us to press the play button twice to be able to play the short video 

(4) You need to use the show() method one time

(5) Screen shot (everything now works fine)



(6) Source Code

Load "guilib.ring"

new qapp {

        win1 = new qMainWindow() {

            setwindowtitle("PlayVideo!")

         setgeometry(300,400,400,400)

         videowidget = new qvideowidget(win1) {

                setGeometry(10,50,300,300)

             setstylesheet("background-color: black")

         }

        player = new qmediaplayer() {

               //setmedia(new qurl("file:///C:/Users/Mahmoud/Desktop/Notes/Ring/bin/drop.avi"))

            setmedia(new qurl("drop.avi"))        

            setvideooutput(videowidget)              

         }

    q1 = new qpushbutton(win1) {

                 setgeometry(50,10,100,30)

              settext("PlayVideo")

              setclickevent("player.play()")

         }

        show()

        }

 exec()

}


Greetings,
Mahmoud

Bert Mariani

unread,
Jun 9, 2016, 9:41:26 PM6/9/16
to The Ring Programming Language
Thanks Mahmoud

The Solution was to install the Codecs -- basic version 

The path entered as follows also worked. No need for  -- file:///C:/Users
     setmedia(new qurl("/Users/Umberto/Videos/ChristinaAguileraCandyman.mp4"))

player = new qmediaplayer() {
#setmedia(new qurl("/Users/Umberto/Videos/GaryUSBondsQuarterToThree.avi"))   <<< Works
setmedia(new qurl("/Users/Umberto/Videos/ChristinaAguileraCandyman.mp4"))      <<< Works
#setmedia(new qurl("/Users/Umberto/Videos/SampleTheMythSanWa2005.mkv"))    <<< Works
#setmedia(new qurl("/Users/Umberto/Videos/drop.avi"))    <<< See capture. Works -- but error msg 80040266
#setmedia(new qurl("drop.avi"))                                          <<< See capture. Works -- but error msg 80040266
setvideooutput(videowidget)              

 }

See screen captures







On Thursday, June 9, 2016 at 11:49:56 AM UTC-4, Bert Mariani wrote:
AA-PlayMovieShort3-MF.ring

Mahmoud Fayed

unread,
Jun 10, 2016, 1:15:29 AM6/10/16
to The Ring Programming Language
Hello Bert

Thanks for the update, Keep up the good work :D

Note: you can use ringw.exe to run ring programs without the console window (avoid warning messages)

Greetings,
Mahmoud

Ali Limited

unread,
Jan 9, 2020, 3:03:16 PM1/9/20
to The Ring Programming Language


Hi Mahmoud


this code for video player do not work


 load "videoView.ring"


import System.GUI


if IsMainSourceFile() {

new App {

StyleFusion()

open_window(:videoController)

exec()

}

}


class videoController from windowsControllerParent


oView = new videoView

oview.d.setnotchesvisible(1)

p

func add1()

l1 = oview.l

frm = oview.win


new filedialog(frm){

viv=getopenfilename(frm,"open file","","file(*.flv;*.mp3;*.3gp;*.mp4)")


}


p=new mediaplayer()

p.setmedia(new url(viv))

p.setvideooutput(oview.vid)

l1.settext(viv)




func pla() p.play()




func change()

oview.a.settext("" + oview.d.value())

p.setvolume(oview.d.value())




Reply all
Reply to author
Forward
0 new messages