c# - WPF MediaElement FREEZES when setting Position to end of video -


i implemented simple video player. in it, there mediaelement , slider, among other things. anyway, when slide slider way right , set mediaelement.position end of video, video freezes on last frame of video , not resume or respond pause/play commands until load different video mediaelement.

i put in small hack change position value numbers @ least 20 milliseconds end of video, , problem went away:

if ( _mediaelement.hasvideo &&      _mediaelement.naturalduration.hastimespan &&      (_mediaelement.naturalduration.timespan.totalmilliseconds - e.newvalue) > 20) {      _mediaelement.position = new timespan(0, 0, 0, 0, (int) e.newvalue); } 

what don't understand why video freeze on last frame? bug in mediaelement control, or there other way work around problem?

i found post 3 years ago describing seems same problem, , solution updated nvidia driver. have date nvidia driver , still have problem. guess above hack works, seems kinda strange video lock that.

please, check if have unloaded behavior property set close. try setting manual. think close implies unloading video , therefore further actions have no effect.

<mediaelement source="media\numbers.wmv" name="mymediaelement"   width="450" height="250" loadedbehavior="manual" unloadedbehavior="manual" /> 

Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -