Eggybread
Eggybread

Reputation: 359

Changing the src of a video with Asp.Net/VB.Net

I'm just a beginner with all this and want to display a video on my website which can be changed from the VB code. I found a website which said to use the video tag. The code has 2 lines which add backup codecs by the look of it so I'd like to keep that if possible. I added ID="videoToPlay" and runat="server" to it in hope I could simply change the file to play with videoToPlay.src="" but no luck. Any help appreciated.

<video ID="videoToPlay" runat="server" src="catalog/videos/636951035994809759_20190602_201932.mp4" style="width:90%; height:315" controls>
    <source src="devstories.webm" type='video/webm;codecs="vp8, vorbis"'/>
    <source src="devstories.mp4" type='video/mp4;codecs="avc1.42E01E, mp4a.40.2"'/>
</video>


Dim videoToPlay As Video
videoToPlay.src="catalog/videos/" & session("video")

I am getting error.. Compiler Error Message: BC30456: 'source' is not a member of 'video'.

Upvotes: 0

Views: 232

Answers (1)

user6593469
user6593469

Reputation:

Remove the source from the Video ID.

    <video ID="videoToPlay" runat="server" style="width:90%; height:315" controls>
        <source src="devstories.webm" type='video/webm;codecs="vp8, vorbis"'/>
        <source src="devstories.mp4" type='video/mp4;codecs="avc1.42E01E, mp4a.40.2"'/>
    </video>


Dim videoToPlay As Video
videoToPlay.src="catalog/videos/" & session("video")

Upvotes: 1

Related Questions