flutter-tizen / plugins

Flutter plugins for Tizen
64 stars 46 forks source link

[video_player_videohole] Problem playing widevine #599

Open MAUstaoglu opened 1 year ago

MAUstaoglu commented 1 year ago

Problem playing widevine. What works: works fine - cenc mpeg dash content with public proxy content https://storage.googleapis.com/wvmedia/cenc/h264/tears/tears_uhd.mpd proxy https://proxy.uat.widevine.com/proxy?provider=widevine_test works partialy - cbcs mpeg dash content with public proxy - it starts playing but it stops after some tim content https://storage.googleapis.com/wvmedia/cbcs/h264/tears/tears_aes_cbcs.mpd proxy https://proxy.uat.widevine.com/proxy?provider=widevine_test doesnt't work any widevine encrypted content created with shaka packager (which plays fine in shaka player web and on android) cbcs not working cenc not work both mpd and HLS not working How did we test: create content by using shaka packager put content on web play it in shaka player demo (web browser) play it on android play it on tizen ie. cd /var/www/html package_wv /tmp/path/to/clear/mp4/video.mp4 ./video-encrypted It will create both .m3u8 and .mpd files you can play over browser using above mentioned hls player

file=$1
out=$2
key=1ae8ccd0e7985cc0b6203a55855a1034afc252980e970ca90e5202689f947ab9
iv=d58ce954203b7c9a9a9d467f59839249
keyurl=https://license.uat.widevine.com/cenc/getcontentkey/widevine_test
packager input=$file,stream=audio,init_segment=$out.audio.init.mp4,segment_template=$out.audio_\$Number\$.mp4  input=$file,stream=video,init_segment=$out.video.init.mp4,segment_template=$out.video_\$Number\$.mp4 --enable_widevine_encryption --protection_scheme cbcs --clear_lead 0 --key_server_url $keyurl --content_id 7465737420636f6e74656e74206112 --signer widevine_test --aes_signing_key $key --aes_signing_iv  $iv --hls_playlist_type VOD --time_shift_buffer_depth 30 --mpd_output $out.mpd --hls_master_playlist_output $out.m3u8

xuelian-bai commented 1 year ago

@MasterSon05 Please share your device info: Menu->Support-> About this TV --> Software Version

wanchao-xu commented 1 year ago

@MasterSon05 , I checked this problem on my TV, the cenc mpeg dash content works well, and cbcs mpeg dash content can not be played. And I am not sure what do you mean about the following content.

any widevine encrypted content created with shaka packager (which plays fine in shaka player web and on android)
cbcs not working
cenc not work  =>  You saied cenc can work before, what do you mean?
both mpd and HLS not working  => Do you mean the cbcs of both dash and HLS are not work?
delacko commented 1 year ago

Hi, we I tested this together with @MasterSon05 with video_player_videohole. Content plays or does not play based on shaka-packager version used. All of this content works fine if one tests in shaka player demo (https://shaka-player-demo.appspot.com/demo/#audiolang=en-US;textlang=en-US;uilang=en-US;panel=CUSTOM%20CONTENT;build=uncompiled)

Device tested: UE43BU8072UXXH (2022 TV, basic model)

Does not work at all with either CBCS or CENC encrypted widevine for newer shaka packager

Works fine with both CBCS and CENC encrypted widevine for older shaka packager:

Clear stream packaged with and shaka packager:

How were the test samples made:


bash script package_wv:

file=$1
out=$2
key=1ae8ccd0e7985cc0b6203a55855a1034afc252980e970ca90e5202689f947ab9
iv=d58ce954203b7c9a9a9d467f59839249
keyurl=https://license.uat.widevine.com/cenc/getcontentkey/widevine_test
#packager=/usr/local/bin/packager
#packager=/usr/local/bin/packager_2.3.0
#packager=/usr/local/bin/packager_2.5.1
packager=/usr/local/bin/packager_2.4.1
#test_content_id  -> base64 | 64tohex
contentid=7465737420636f6e74656e74206964

#can be cens or cbcs  
encryption=cbcs

packager input=$file,stream=audio,init_segment=$out.audio.init.mp4,segment_template=$out.audio_\$Number\$.mp4  input=$file,stream=video,init_segment=$out.video.init.mp4,segment_template=$out.video_\$Number\$.mp4 --enable_widevine_encryption --protection_scheme $encryption --clear_lead 0 --key_server_url $keyurl --content_id $contentid --signer widevine_test --aes_signing_key $key --aes_signing_iv  $iv --hls_playlist_type VOD --mpd_output $out.mpd --hls_master_playlist_output $out.m3u8

delacko commented 1 year ago

I prepared urls so anybody can test this:

HLS samples:

cenc https://devel.uniqcast.com/wv/samples/bbb_cenc_2.4.1/bbb_cenc_2.4.1.m3u8 https://devel.uniqcast.com/wv/samples/bbb_cenc_2.6.1/bbb_cenc_2.6.1.m3u8 https://devel.uniqcast.com/wv/samples/bbb_cenc_2.5.1/bbb_cenc_2.5.1.m3u8

cbcs https://devel.uniqcast.com/wv/samples/bbb_cbcs_2.5.1/bbb_cbcs_2.5.1.m3u8 https://devel.uniqcast.com/wv/samples/bbb_cbcs_2.4.1/bbb_cbcs_2.4.1.m3u8 https://devel.uniqcast.com/wv/samples/bbb_cbcs_2.6.1/bbb_cbcs_2.6.1.m3u8

no encryption https://devel.uniqcast.com/wv/samples/bbb_none_2.6.1/bbb_none_2.6.1.m3u8 https://devel.uniqcast.com/wv/samples/bbb_none_2.5.1/bbb_none_2.5.1.m3u8 https://devel.uniqcast.com/wv/samples/bbb_none_2.4.1/bbb_none_2.4.1.m3u8

MPEG dash samples:

cenc https://devel.uniqcast.com/wv/samples/bbb_cenc_2.4.1/bbb_cenc_2.4.1.mpd https://devel.uniqcast.com/wv/samples/bbb_cenc_2.6.1/bbb_cenc_2.6.1.mpd https://devel.uniqcast.com/wv/samples/bbb_cenc_2.5.1/bbb_cenc_2.5.1.mpd

cbcs https://devel.uniqcast.com/wv/samples/bbb_cbcs_2.5.1/bbb_cbcs_2.5.1.mpd https://devel.uniqcast.com/wv/samples/bbb_cbcs_2.4.1/bbb_cbcs_2.4.1.mpd https://devel.uniqcast.com/wv/samples/bbb_cbcs_2.6.1/bbb_cbcs_2.6.1.mpd

no encryption https://devel.uniqcast.com/wv/samples/bbb_none_2.6.1/bbb_none_2.6.1.mpd https://devel.uniqcast.com/wv/samples/bbb_none_2.5.1/bbb_none_2.5.1.mpd https://devel.uniqcast.com/wv/samples/bbb_none_2.4.1/bbb_none_2.4.1.mpd

MAUstaoglu commented 1 year ago

@MasterSon05 Please share your device info: Menu->Support-> About this TV --> Software Version

Software Version: T-KSU2EBDEUC-1403.6, BT-S

wanchao-xu commented 1 year ago

@MasterSon05 , about widevine https://storage.googleapis.com/wvmedia/cbcs/h264/tears/tears_aes_cbcs.mpd, I tested it on T-KSU2EBAKUC-0113.12 which version is near T-KSU2EBDEUC-1403.6, this problem can be reproduced, the widevine can be played a moment and stopped.

I checked the platform log, there is a decryption error of platform player. Currently we use mmplayer to implement video_player_videohole, I tried to use plusplayer and this widevine can be played successfully. You can try this plugin https://github.com/hyue7/plugins/tree/video_player_plusplayer/packages/video_player_plusplayer, but plusplayer is not published, so it need the partner certification when build app.

wanchao-xu commented 1 year ago

@delacko , I tested the samples which you provided, HLS samples are same as you saied, the encrypted widevine which generated by shaka packager 2.5/2.6 can not be played. But the MPEG dash samples has some problems, all MPEG dash samples can not be played by shaka player and video_player_videohole. I can not use shaka packager because https://license.uat.widevine.com/cenc/getcontentkey/widevine_test can not be connected. Could you check the MPEG dash samples is right or not?

MAUstaoglu commented 1 year ago

@MasterSon05 , about widevine https://storage.googleapis.com/wvmedia/cbcs/h264/tears/tears_aes_cbcs.mpd, I tested it on T-KSU2EBAKUC-0113.12 which version is near T-KSU2EBDEUC-1403.6, this problem can be reproduced, the widevine can be played a moment and stopped.

I checked the platform log, there is a decryption error of platform player. Currently we use mmplayer to implement video_player_videohole, I tried to use plusplayer and this widevine can be played successfully. You can try this plugin https://github.com/hyue7/plugins/tree/video_player_plusplayer/packages/video_player_plusplayer, but plusplayer is not published, so it need the partner certification when build app.

When I get a build with a partner certificate, I can play the videos in the example application without any problems. Although widevine works in the example app with the partner certificate. The ones we tried with Shaka 2.5.1 and 2.6.1 packer did not work. It seems to work fine with the 2.4.x packer. But I guess it doesn't work with a higher packer version. And it is irrelevant if we use mpeg dash or HLS.

delacko commented 1 year ago

@delacko , I tested the samples which you provided, HLS samples are same as you saied, the encrypted widevine which generated by shaka packager 2.5/2.6 can not be played. But the MPEG dash samples has some problems, all MPEG dash samples can not be played by shaka player and video_player_videohole. I can not use shaka packager because https://license.uat.widevine.com/cenc/getcontentkey/widevine_test can not be connected. Could you check the MPEG dash samples is right or not?

@wanchao-xu you should use this proxy when playing: https://cwip-shaka-proxy.appspot.com/no_auth When creating content with shaka packager you should use this as key server: https://license.uat.widevine.com/cenc/getcontentkey/widevine_test

So the url https://license.uat... is the url you pass to shaka packager in command line argument --key_server_url

Both of these are always available as they are widevine's public test resources. Those samples of content I made will work only with this public widevine proxy using widevine provider widevine_test. (if you have a private widevine proxy it will not work)

How to play widevine samples:

  1. build an app which will play url together with appropriate widevine proxy
  2. sign the app with partner certificate key
  3. run app on tizen tv

Example of combination that works: widevine mpeg dash url made on shaka packager 2.4.1: https://devel.uniqcast.com/wv/samples/bbb_cenc_2.4.1/bbb_cenc_2.4.1.mpd widevine proxy: https://cwip-shaka-proxy.appspot.com/no_auth

Example of combination that does not work: widevine mpeg dash url made on shaka packager 2.6.1: https://devel.uniqcast.com/wv/samples/bbb_cenc_2.6.1/bbb_cenc_2.6.1.mpd widevine proxy: https://cwip-shaka-proxy.appspot.com/no_auth

delacko commented 1 year ago

We tested plusplayer and videohole (mmplayer). They behave completely the same. For shaka packager 2.4.1:

For shaka packager 2.6.1:

I have attached table showing our tests. image

We also tried to test tizen HTML app - on that app all these urls work with hls.js player. Meaning whatever problem exists here - it does not exists in Tizen Web apps using MSE/EME - which hls.js uses.

xuelian-bai commented 1 year ago

@delacko I'm sorry that for now we can't support shaka packager 2.5.1 or higher, since there is some difference in fmp4 segments. We may support this in the future, if you really need this feature in your product, please send me mail to talk about this(xuelian.bai@samsung.com). The reason that Tizen Web app which using hls.js player can work is, hls.js player parse container by itself, Chrome didn't call platform player like flutter plugin did.

delacko commented 1 year ago

@xuelian-bai do you have any details on what changed in mp4 between shaka packager 2.4 and 2.5+ (ie. if you know some mp4 box information missing, or similar problem). If we knew this information I believe we could patch shaka packager 2.6 to make this work.

2.4.x was stopped being developed in 2020. Most encoder companies and all almost all small companies using vod and live on widevine use shaka packager to package their content for widevine, so I expect we will see see this problem very often.

We also tried to encrypt content for widevine with mp4encrypt (from bento4 project) - it is also working fine for widevine on all other devices but not on Samsung. My guess is that a lot of Widevine packagers out there are not compatibile with fltuter-tizen widevine player.

For us this means that for all project requiring widevine we need to use HTML app with hls.js for Samsung TVs and cannot go with much faster and nicer app using flutter-tizen. HTML5 app for same Samsung TVs using hls.js (extension over HTML5 video player) works with all widevine packagers we tried.

xuelian-bai commented 1 year ago

hmm. Now I know about the situation, as you know, this issue couldn't be fixed in flutter-tizen plugin side, we need to talk with platform team about this, I will get back to you then. For more details, for example, in 2.5.1 the fmp4 segments have the multiple PSSH (2), one contains the system id of widevine and another contains the common system id, but we expect only one system id.

hyue7 commented 11 months ago

Hi,all! We have fixed the issue about hls+cbcs, hls+cenc generated by shaka-packager. But you need wait OTN for fix this issue, however, we are not sure when the OTN will be scheduled. By the way, we are doing update of videohole plugin based on mmplayer and plusplayer, plusplayer support more features, and you don't need wait OTN for fix issues.

MAUstaoglu commented 11 months ago

Hello, thank you for the fix. When does the prediction become testable? Will you also add plusplayer to the videohole plugin or will there be a new plugin like video_player_plusplayer?

hyue7 commented 11 months ago

Hi, plusplayer will be added to video_player_videohole this week or next week, and the you can test~

AUGxhub commented 11 months ago

@MasterSon05 @delacko
hello shaka packager team can you share the vod version of shaka packager lastest verion(2.6.1) + drm + dash test content ?

MAUstaoglu commented 11 months ago

Hello @AUGxhub You can use the content we have shared before.

contents: