| 1. |
Solve : HTML5 Tag to play MP4 from browser issue? |
|
Answer» Messing around with HTML5 and was looking for a way to get a small MP4 video to have the ability to click and play it locally. The test1.mp4 file resides in the same folder as the HTML file that calls to it. It doesn't error out and it shows what looks like the ability to click to play it but nothing happens when clicking to play the MP4 file. I should note, the reason you can open it directly is that when you directly open a video file in Firefox, it will not go through the HTML5 codecs and basically uses DirectShow directly (on Windows), which means it can then play codecs unsupported by HTML5. Interesting that the MP4 with that method takes a different path... so it is apples to oranges and thats why broken one way and works the other through firefox. I haven't dabbled much with HTML in a few years and this person at work was saying about how much better HTML5 is and I was like well I will check into how much better it is. Found that reference to proper use of playing video CONTENT and figured it was going to be easy to get it to work. Then had the idea of writing some C++ that dynamically generates HTML pages based on movies I have in my collection and have a fun winter programming project to dabble into. I guess I am going to see if I can find an addon that might be the CURE for the codec issue. Tried it with Chrome, Firefox, and Edge and they all just bring up a player interface but the video doesn't load to the interface. Really crazy that the HTML5 approach to media is test test test and bail so not really any standards if you have to hunt through a list and like you said some browsers bail at first attempt and wont continue to test before getting to the end error message. I would have expected that if not supported that the message of "Your browser does not support the video element. Kindly update it to latest version." would have displayed. Don't know why, but its working now. Ever since I messed around with this example online with sizing the video play it started to work. I then removed the sizing and autoplay and made it the same as it was prior and then it works. I thought maybe with it sized to 320x240 caused the video to pre cache somehow in order to play it full window when width and height removed and so I rebooted the computer so wipe the temp cache clean. And now its working as its suppose to. I didn't add any codecs as I was originally going to try. I instead went to a different reference online to the HTML5 Video tag examples and copy pasted in the example and changed the file name to test1.mp4 Comparison between what I had prior and now I see nothing different to be the mysterious cure for the video load and playback issue. Even going with the original error message to display if unsupported for playback of " Your browser does not support the video element. Kindly update it to latest version." made no difference, as at first I was like maybe that was it that it would only display one sentence and the period was like an endline instruction to the browser and two sentences with two periods was the cause. Well I guess I will move forward now with the dynamic HTML generated from my C++ program since the issue is hopefully gone for good. It just bothers me not knowing why it fought me so much to work. No codecs added and no changes made to browser, not even a reboot of the computer for a fresh start, and it mysteriously works now. Thanks for your help with this BC Code: [Select]<HTML> <BODY> <center> <video controls> <source src="test1.mp4" type="video/mp4"> Your browser does not support the video tag. </video> </BODY> </HTML> |
|