billythekids / plugin.video.bimozie

Support to watch movies on several Vietnamese sites
GNU General Public License v3.0
38 stars 24 forks source link

Need help to play m3u8 #2

Closed sviet2k closed 5 years ago

sviet2k commented 5 years ago

Hi Billy,

First I am really sorry if this is not a place to get help. I am learning to create Kodi addon and I have problem to play a m3u8. https://pastebin.com/9h5fHWn6 This m3u8 (saved on my window hd) can be played with VLC but Kodi cannot play it using the File path. Kodi can play if I pass directly the 'https://doc-04-bc-docs.googleusercontent.com' url but there is no seek option on Kodi player. If you have time, can you please help me to make it work on Kodi ?

Here is the "Original" m3u8: https://pastebin.com/vZBwhXaC

Thanks in advance for your help

hikenshi commented 5 years ago

Hi, maybe you have path incorrect in your code, can you show the code or error?

Vào Th 4, 24 thg 4, 2019 vào lúc 00:38 sviet2k notifications@github.com đã viết:

Hi Billy,

First I am really sorry if this is not a place to get help. I am learning to create Kodi addon and I have problem to play a m3u8. https://pastebin.com/9h5fHWn6 This m3u8 (saved on my window hd) can be played with VLC but Kodi cannot play it using the File path. Kodi can play if I pass directly the ' https://doc-04-bc-docs.googleusercontent.com' url but there is no seek option on Kodi player. If you have time, can you please help me to make it work on Kodi ?

Here is the "Original" m3u8: https://pastebin.com/vZBwhXaC

Thanks in advance for your help

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/billythekids/plugin.video.bimozie/issues/2, or mute the thread https://github.com/notifications/unsubscribe-auth/AIAHOK64RHUYTDUPORH3WYTPR5CRVANCNFSM4HH4QTOQ .

sviet2k commented 5 years ago

Hi hikenshi,

First thanks for your help. The path is very sample: I copy the m3u8 to a file and use it as path for kodi. (Same approach as bimozie:) )

Please find the debug.log in: https://pastebin.com/G27igvNU In debug log, there is a line: Open - Error, could not open file /storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/plugin.video.test/download/stream1.m3u8 It seems that the file does not exist but it's not true. The real problem is Kodi cannot create demuxer for this m3u8.

And here the code to generate the m3u8 https://pastebin.com/3YezuztL

Again thanks for your help

hikenshi commented 5 years ago

You are using windows, the path is incorrect. That path for unix like os By the way, stream1.m3u8 , where are you save it? You are download that m3u8 then saved it on "addons/..."?

Vào Th 4, 24 thg 4, 2019 lúc 23:38 sviet2k notifications@github.com đã viết:

Hi hikenshi,

First thanks for your help. The path is very sample: I copy the m3u8 to a file and use it as path for kodi. (Same approach as bimozie:) )

Please find the debug.log in: https://pastebin.com/G27igvNU In debug log, there is a line: Open - Error, could not open file /storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/plugin.video.test/download/stream1.m3u8 It seems that the file does not exist but it's not true. The real problem is Kodi cannot create demuxer for this m3u8.

Again thanks for your help

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/billythekids/plugin.video.bimozie/issues/2#issuecomment-486322780, or mute the thread https://github.com/notifications/unsubscribe-auth/AIAHOK3G2L47CJLYRJJJ4LLPSCEINANCNFSM4HH4QTOQ .

sviet2k commented 5 years ago

I am sorry that I forget to clarify my test environment: I use my android phone to test with Kodi 18. The debug log is come from my Phone Android Kodi 18. The stream1.m3u8 is build in my addon code (https://pastebin.com/3YezuztL) and save it under the < addon dir >/download And I see the file is under this dir on my phone.

billythekids commented 5 years ago

Have you tried with file://pathfile.m3u8 instead only pathfile.m3u8?

sviet2k commented 5 years ago

Thanks Billy for your time.

Unfortunately, adding the "file://" does not work but I see in the kodi.log this error: "416 Range Not Satisfiable" because of this line: "#EXT-X-BYTERANGE::388032@18" in m3u8 file. If I remove this line, Kodi can play m3u8 👍 but the first 4,5 seconds of the movie is repeated many time.

Do you know how to recalculate the BYTERANGE ?

Thank you for your help

billythekids commented 5 years ago

Its really nice what you have done so far. I got same issue with you when i tried to implement hydrax link. You can find the sample workable code there. Basically you need to recalculate the total bytes of the same segment (identical url), this is the 1st argument of ext-x-bytes, 2nd is the lowest decimal of those segments it means the beginning byte to read. Then you also need sum all the ext-inf for the total playing time of each segment. Finally replacing them with your new modified content.

sviet2k commented 5 years ago

Hi Billy,

Thanks a lot for your help. To simplify the code, I only calculate the total of extinf (not the byterange) for each unique segment and I ignore the byterange. And it's working 👍 . Is it "normal" that it's working?

Fixed: Do a retry and the get header will return correct url.

Other problem I discovered during the test: when the get header returns: https://www.googleapis.com/drive/v3/files/1gwnYVDNtlCiRsiVkMi7qnh0K1qlIclSs?alt=media&key=AIzaSyBiHo_XR48e6TuN7XtI4YozGKohDiIirGk Kodi cannot play this. Do you know how to resolve the googleapis url ?

Again thanks a lot for your help

billythekids commented 5 years ago

Did you try with urlresolver to get it?

sviet2k commented 5 years ago

Yes. I tried urlresolver and the new resolverurl from jsergio but they cannot get it.

billythekids commented 5 years ago

Can you send me your final working playlist? I tested with other playlist which including api link, and its working fine

sviet2k commented 5 years ago

Here is the m3u8 that I cannot play. https://pastebin.com/SYGmyg9K I am really appreciate that you take time to help me to troubleshoot this 👍

I also create a 'Master' m3u8 to call the above m3u8 as you did:

EXTM3U

EXT-X-VERSION:3

EXT-X-STREAM-INF:BANDWIDTH=3998000,RESOLUTION=9999x9999

< ADDON DIR >/stream1.m3u8

And I give kodi the path of the master m3u8

Thanks again

billythekids commented 5 years ago

Hows about the origin playlist? i need it for comparison I guess your issue happened because you'd removed byterange part

sviet2k commented 5 years ago

Here is the original: https://pastebin.com/Rgxnrn3v

Here is my build (no byterange) https://pastebin.com/i2cWjyVE

billythekids commented 5 years ago

I saw 2 problems here

  1. You shouldn't remove the byte range part, without it, player cannot read the video

  2. The encrypted key section also has to be kept otherwise video cannot decrypt. But i'm still stuck there, i cannot manage to make kodi loading the key

My current working version for hydrax link without aes key https://github.com/billythekids/plugin.video.bimozie/blob/master/resources/lib/utils/hosts/hydrax.py

sviet2k commented 5 years ago

Thanks a lot for your help Billy. I will try to understand the hydrax code and apply it to mine. 👍