How do you display mp4 video containing chapters via asp.net web application project?

David Anderson 206 Reputation points
2025-10-19T14:47:45.7166667+00:00

I have created MP4 videos that contain chapters. I can select those chapters when I play them on my Windows 11 computer using VLC or JRiver Media Center but I have failed to find a way to make chapters visible when these videos are made accessible online via a page of an ASP.NET web application project.

Is this possible? If so, I would appreciate some sample code.

Developer technologies | ASP.NET | Other
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Raymond Huynh (WICLOUD CORPORATION) 2,215 Reputation points Microsoft External Staff
    2025-10-22T09:09:41.0233333+00:00

    Hello David Anderson ,

    I see you've set up the VTT chapters file correctly. However, browsers don't display chapters automatically, so you'll need to add some JavaScript to create the visible navigation.

    Fix your HTML first:

    <video controls width="1920" height="1080">
    <source src="Recordings/Short sample.mp4" type="video/mp4">
    <track kind="chapters" src="MyChaptersVTT.vtt" srclang="en" default>
    </video>
    

    JavaScript sample for visible chapter navigation:

    const video = document.querySelector('video');
    video.addEventListener('loadedmetadata', () => {
        const track = video.textTracks[0];
        track.cues.forEach(cue => {
            const button = document.createElement('button');
            button.textContent = cue.text;
            button.onclick = () => video.currentTime = cue.startTime;
            document.body.appendChild(button);
        });
    });
    

    This is just sample code to demonstrate the concept. You'll need to add proper error handling and CSS styling for production use. The VTT provides the data, but you must build the entire UI yourself since browsers don't show chapter markers by default.

    Hope this helps!

    1 person found this answer helpful.

  2. Bruce (SqlWork.com) 81,191 Reputation points Volunteer Moderator
    2025-10-19T17:03:55.5233333+00:00

    See docs on controlling video with JavaScript. You are interested in tracks support

    https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/video


  3. Quintus Jonath 0 Reputation points
    2025-10-24T18:15:42.3633333+00:00

    Yes, it’s possible to display and use chapters in videos online, but it depends on how the chapters are stored and how you’re serving the video.

    When you play the file locally in VLC or JRiver, those apps are reading the chapter metadata that’s embedded inside the MP4 container. Unfortunately, most browsers and HTML5 <video> players don’t natively recognize MP4 chapter metadata. The chapter info isn’t exposed through the browser’s media API, so you won’t see them automatically on a web page.

    To make chapters work in a web environment, you have a couple of options:

    Create a separate “chapters” (VTT) file You can export or manually create a WebVTT file that defines chapter start times and titles. For example:

    WEBVTT
    
    00:00:00.000 --> 00:03:30.000
    Introduction
    
    00:03:30.000 --> 00:10:00.000
    Main Topic
    
    00:10:00.000 --> 00:15:45.000
    Summary
    

    Then include it in your HTML:

    <video id="myVideo" controls>
        <source src="video.mp4" type="video/mp4">
        <track src="chapters.vtt" kind="chapters" label="Chapters" default>
    </video>
    

    Most browsers don’t show a chapter menu by default, but you can read these tracks through JavaScript and build your own chapter list or navigation buttons.

    Use a JavaScript player that supports chapters Players like Video.js, Plyr, or JW Player can parse WebVTT chapter files and display them in a nice interface. You’d just need to add the plugin or configuration that enables chapters.

    ASP.NET side Your ASP.NET page can simply host the HTML/JavaScript player. You don’t need special server-side code for this unless you want to dynamically generate the chapter data.

    So in short, browsers don’t use the embedded MP4 chapters directly — you’ll need to provide them separately (as WebVTT) or use a player that can read them.


  4. David Anderson 206 Reputation points
    2025-10-25T21:38:27.4766667+00:00

    After a lot more Google searches, I found the answer to my problem. It did indeed require mime mapping, which was done by adding the following code to the configuration section of the ASP.NET web.config file.

    	<system.webServer>
    		<staticContent>
    			<remove fileExtension=".vtt" />
    			<mimeMap fileExtension=".vtt" mimeType="text/vtt" />
    		</staticContent>
    	</system.webServer>	
    
    
    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.