Pregunta

I am attempting to use video.js in a project. If I use the following video tag, it will work as expected.

<video id="videoTag" class="video-js vjs-default-skin" controls="controls"
    preload="auto" width="640" height="264" poster="null"
    data-setup="{}" runat="server">
       <source src="http://cite1.nwmissouri.edu/NWCloudTest/convertedVideos/
        424a909969434ae392c8ec7563fcbac8.mp4" type='video/mp4' />
</video>

However, if I attempt to set the source dynamically in my C# code, the video player just spins and plays no video. If I look at the source for the webpage it shows the correct source in the video tag.

Here is the C# code:

videoTag.Attributes["src"] = "http://cite1.nwmissouri.edu/NWCloudTest/convertedVideos/424a909969434ae392c8ec7563fcbac8.mp4";

What am I missing?

¿Fue útil?

Solución

You need to get rid of the <source/> element. Once you have, set the type and src attributes of the </video> tag(with their respective values that you were setting in the <source/> tag). Also, make sure that your video tag is set to autoplay.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top