Samsung / tizen-common-web

Apache License 2.0
11 stars 4 forks source link

URL.createObjectURL() not working on Tizen 6.5. as source for <video> elements. #11

Open IureaBogdan opened 1 year ago

IureaBogdan commented 1 year ago

Hello,

After I found the solution for this issue, I started to test the app on Tizen 4.0 and Tizen 6.5.

The app downloads files as blobs, then URLs are created from them so they can be used as a source for img and video elements.

The problem is that the app works perfectly on Tizen 4.0, but on Tizen 6.5 I get this error for the video element: Failed to load because no supported source was found.

I've done some research, and after some time I found this thread on stackoverflow. I tried the solution just to check if there was a problem with the Blob parsing. It was not the case. Also, the solution in the thread is not that optimal because parsing a blob to an array buffer then creating a new blob from the array buffer is taking time.

According to Tizen Web Engine Specifications, Tizen 4.0. is using Chromium M56 and Tizen 6.5 is using Chromium M85. So... I'm thinking it must be a web engine incompatibility as I've seen a lot of Chromium Issues which are about Chromium M80 -> Chromium M85 and their problems regarding Blobs, creating a link from a Blob, CSP bypass through blob and so on.

The app is using only browser libraries so, it can also be served as a web app. So, I served it using an http-server then I accesed it from Tizen Samsung Browser and the behavior is the same. It works on the TV with Tizen 4.0 but not on the TV with Tizen 6.5.

config.xml ** Please ignore the <tizen:content-security-policy> as I am using this CSP only for testing the app locally.

<?xml version="1.0" encoding="UTF-8"?>  
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets" version="1.0.0" viewmodes="maximized">  
  <name>Player</name>  
 <icon src="icon.png"/>  
 <content src="index.html"/>  
 <tizen:profile name="tv"/>  
 <feature name="http://tizen.org/feature/screen.size.normal.1080.1920"/>  
 <tizen:application id="s59VSaNd4F.Player" package="s59VSaNd4F" required_version="2.3"/>  
 <tizen:setting background-support="disable" context-menu="enable" encryption="disable" hwkey-event="enable" install-location="auto" screen-orientation="auto-rotation"/>  
 <tizen:privilege name="http://tizen.org/privilege/tv.inputdevice"/>  
 <tizen:privilege name="http://tizen.org/privilege/internet"/>  
 <tizen:privilege name="http://developer.samsung.com/privilege/network.public"/>  
 <tizen:privilege name="http://tizen.org/privilege/tizen"/>  
 <tizen:privilege name="http://tizen.org/privilege/system"/>  
 <tizen:privilege name="http://tizen.org/privilege/filesystem.read"/>  
 <tizen:privilege name="http://tizen.org/privilege/filesystem.write"/>  
 <tizen:privilege name="http://tizen.org/privilege/mediastorage"/>  
 <tizen:privilege name="http://tizen.org/privilege/externalstorage"/>  
 <tizen:privilege name="http://tizen.org/privilege/download"/>  
 <tizen:privilege name="http://developer.samsung.com/privilege/b2bcontrol"/>  

 <tizen:content-security-policy> default-src *  data: blob: filesystem: about: ws: wss: 'unsafe-inline' 'unsafe-eval' 'unsafe-dynamic'; script-src * data: blob: 'unsafe-inline' 'unsafe-eval'; connect-src * data: blob: 'unsafe-inline'; img-src * data: blob: 'unsafe-inline'; frame-src * data: blob: ; style-src * data: blob: 'unsafe-inline'; font-src * data: blob: 'unsafe-inline'; frame-ancestors * data: blob: 'unsafe-inline';  
  </tizen:content-security-policy>  
 <tizen:allow-navigation>*</tizen:allow-navigation>  
 <access origin="*" subdomains="true"/>  
</widget>

Images from real devices:

In the top-left corner is the result of URL.createObjectURL().

Tizen 4.0.

Tizen 4 0

Tizen 6.5.

Tizen 6 5

pwsses commented 1 year ago

Hello. As you know, URL.crateObjectURL API is common web api so It from web engine issue on tizen.
You may have misunderstood because of our repository name. this repository for typescript of tizen common webapis. ex) tizen.application... I think please contact to samsung developer site(https://developer.samsung.com/) or tizen developer site(https://developer.tizen.org/)

thank you.