upload tizen1.0 source
[framework/web/webkit-efl.git] / LayoutTests / media / media-captions.html
1 <html>
2     <head>
3         <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
4         <title>closed caption API test</title>
5
6         <script src=video-test.js></script>
7         <script src=media-fullscreen.js></script>
8
9         <script>
10             var movieInfo = 
11             {
12                 current : -1,
13                 movies : 
14                 [ 
15                     {
16                         url : "content/test.wav", 
17                         description : "Audio-only file without captions", 
18                         hasCaptions : false,
19                     },
20                     {
21                         url : "content/counting-captioned.mov", 
22                         description : "QuickTime movie with captions.", 
23                         hasCaptions : true,
24                     },
25                 ]
26             };
27
28
29             function canplaythrough()
30             {
31                 var movie = movieInfo.movies[movieInfo.current];
32             
33                 testExpected("mediaElement.webkitHasClosedCaptions", movie.hasCaptions);
34                 testExpected("mediaElement.webkitClosedCaptionsVisible", false);
35                 
36                 // Try to enable captions, they should only be enabled after if the movie has captions.
37                 consoleWrite("*** enabling captions");
38                 mediaElement.webkitClosedCaptionsVisible = true;
39                 testExpected("mediaElement.webkitClosedCaptionsVisible", movie.hasCaptions);
40
41                 openNextMovie();
42             }
43             
44             function openNextMovie()
45             {
46                 consoleWrite("");
47
48                 movieInfo.current++;
49                 if (movieInfo.current >= movieInfo.movies.length)
50                 {
51                     endTest();
52                     return;
53                 }
54
55                 var url = movieInfo.movies[movieInfo.current].url;
56                 video.src = url;
57                 var desc = "<b>Loading</b> <em>\""+ url + "\"</em>" + 
58                             ". " + movieInfo.movies[movieInfo.current].description + ".</em>";
59                 consoleWrite(desc);
60                 if (movieInfo.current > 0)
61                     video.load();
62             }
63             
64             function start()
65             {
66                 findMediaElement();
67
68                 waitForEvent("error");
69                 waitForEvent("loadstart");
70                 waitForEvent("waiting");
71                 waitForEvent("ratechange");
72                 waitForEvent("durationchange");
73                 waitForEvent("pause");
74                 waitForEvent("play");
75                 waitForEvent("playing");
76
77                 waitForEvent('loadedmetadata', canplaythrough);
78
79                 consoleWrite("<b>Test before movie is open:</b>");
80                 testExpected("mediaElement.webkitHasClosedCaptions", false);
81                 testExpected("mediaElement.webkitClosedCaptionsVisible", false);
82             
83                 openNextMovie();
84             }
85
86         </script>
87
88     </head>
89
90     <body onload="start()">
91
92         <video controls></video>
93
94         <p>Test media element close caption API.</p>
95
96     </body>
97 </html>