shaka-project / shaka-player-embedded

Shaka Player in a C++ Framework
Apache License 2.0
238 stars 63 forks source link

How to insert clear ad video in encrypted video #151

Closed cderfv1 closed 4 years ago

cderfv1 commented 4 years ago

We have a business model for inserting advertisements. We will insert an unencrypted advertisement slice into the encrypted positive at any time. I thought I can do it like this:

EXT-X-DISCONTINUITY

EXT-X-MAP:URI="init.mp4"

EXT-X-KEY:METHOD=NONE

EXTINF:9.968,

video_00001.mp4

but I failed, and shaka player stopped after downloading audio.m3u8.

My playurl: ‘https://175883.oss-cn-beijing.aliyuncs.com/05007D00005EF9B92A8BB78000000066C57289-6C3A-4310-B5F7-E11B7ED0059B/05007D00005EF9B92A8BB78000000066C57289-6C3A-4310-B5F7-E11B7ED0059B_1.m3u8

Can you please help me for what is wrong with it? Or should I implement it in other ways?

TheModMaker commented 4 years ago

We don't currently support FairPlay content. See #150.

cderfv1 commented 4 years ago

我们目前不支持FairPlay内容。参见#150。 I use two '#EXT-X-KEY:' to support Widevine&FairPlay. Do you mean that I need to delete FairPlay‘s ’'#EXT-X-KEY:'‘?

EXT-X-KEY:METHOD=SAMPLE-AES,URI="data:text/plain;base64,AAAASnBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAACoSEPMxe/pvakPomHaYYIjpZgQSEPMxe/pvakPomHaYYIjpZgRI88aJmwY=",KEYID=0xF3317BFA6F6A43E89876986088E96604,IV=0x3B8B98A2DD9A5CA663815DF9886E67F1,KEYFORMATVERSIONS="1",KEYFORMAT="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"

EXT-X-KEY:METHOD=SAMPLE-AES,URI="skd://f3317bfa6f6a43e89876986088e96604",KEYFORMATVERSIONS="1",KEYFORMAT="com.apple.streamingkeydelivery"

TheModMaker commented 4 years ago

If you want to play Widevine HLS content, you need to disable src= mode so we play in MSE mode. This is done with setting the streaming.useNativeHlsOnSafari configuration to false. I don't think you need to remove the extra #EXT-X-KEY.

Unfortunately, this project uses v2.5.11 of Shaka Player, which doesn't support #EXT-X-DISCONTINUITY. Once we update to v3.0 we should be able to play it. You should try playing this content in the Shaka Player demo to make sure you can play it in v3.0.

cderfv1 commented 4 years ago

If you want to play Widevine HLS content, you need to disable src= mode so we play in MSE mode. This is done with setting the streaming.useNativeHlsOnSafari configuration to false. I don't think you need to remove the extra #EXT-X-KEY.

Unfortunately, this project uses v2.5.11 of Shaka Player, which doesn't support #EXT-X-DISCONTINUITY. Once we update to v3.0 we should be able to play it. You should try playing this content in the Shaka Player demo to make sure you can play it in v3.0.

Thank you for your help! I update to v3.0,then it success play.