test.html 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <metacharset ="utf-8">
  5. <title>test</title>
  6. </head>
  7. <body>
  8. <div style="text-align:center">
  9. <button onclick="playPause()">>play</button>
  10. <button onclick="makeBig()">111</button>
  11. <button onclick="makeSmall()">1222</button>
  12. <button onclick="makeNormal()">333</button>
  13. <br>
  14. <video id="video1" width="420">
  15. <source src="http://yfklxt-video.ai160.com/vs2m/001/00103200/00103200020/00103200020.m3u8" type="video/mp4">
  16. </video>
  17. </div>
  18. <script>
  19. //需要用到就写这个,不需要就不写(用到哪个写哪个,对应winform的JavascriptObjectRepository.ResolveObject方法)
  20. let bindName = ["efunboxJS", "videoJS"];
  21. bindName.forEach(item => {
  22. CefSharp.BindObjectAsync(item);
  23. })
  24. var myVideo = document.getElementById("video1");
  25. function playPause() {
  26. efunboxJS.showMessage("test");
  27. if (myVideo.paused)
  28. myVideo.play();
  29. else
  30. myVideo.pause();
  31. }
  32. function makeBig() {
  33. myVideo.width = 560;
  34. }
  35. function makeSmall() {
  36. myVideo.width = 320;
  37. }
  38. function makeNormal() {
  39. myVideo.width = 420;
  40. }
  41. </script>
  42. </body>
  43. </html>