readium / r2-testapp-js

NodeJS Readium2 "test app"
BSD 3-Clause "New" or "Revised" License
10 stars 1 forks source link

This function breaks tracks in HTML5 videos. #29

Open ibsusu opened 3 years ago

ibsusu commented 3 years ago

See the title. The track is read from the custom origin that the video is read from after it's loaded.

https://github.com/readium/r2-testapp-js/blob/7204a100a3414bd5eca561aa26dbda5cd562137c/src/electron/main/index.ts#L768

This happens in the old version of readium as well.

I tried to change the location of the file, then I tried to add cors to the express server. What worked is getting rid of the line that I linked.

Here's an example:

<video class="center" src="../1-1.mp4" poster="../images/00015.jpeg" type="video/mp4" controls="controls">
  <track label="Pinyin" kind="subtitles" srclang="en" src="../cuepoints1_1_1.vtt" default="default"/>
  <track label="English" kind="subtitles" srclang="en" src="../cuepoints1_1_2.vtt"/>
  <track label="Simplfied" kind="subtitles" srclang="en" src="../cuepoints1_1_3.vtt"/>
  <track label="Traditional" kind="subtitles" srclang="en" src="../cuepoints1_1_4.vtt"/>
<button id="subtitles" type="button" data-state="subtitles">CC</button>
</video>

Those tracks end up with this error upon playing or selection:

Unsafe attempt to load URL https://127.0.0.1:8000/pub/L1VzZXJzL2licmFoaW1wZWVrL0RvY3VtZW50cy9Cb29rcy9DaGluZXNlL0Jhc2ljIFNwb2tlbiBDaGluZXNlOiBBbiBJbnRyb2R1Y3Rpb24gdG8gU3BlYWtpbmcgYW5kIExpc3RlbmluZyBmb3IgQmVnaW5uZXJzLXB1Yi1jcmVkZW50aWFscy5lcHVi/EPUB/cuepoints1_1_1.vtt from frame with URL httpsr2://id_l1_vz_z_x_jz_l2licm_foa_w1w_z_w_vr_l0_rv_y3_vt_z_w50cy9_cb29rcy9_da_glu_z_x_nl_l0_jhc2lj_i_f_nwb2tlbi_b_da_glu_z_x_nl_oi_b_bbi_b_jbn_ryb2_r1_y3_rpb24gd_g8g_u3_bl_y_wtpbmcg_y_w5k_i_expc3_rlbmlu_zy_bmb3_ig_qm_vna_w5u_z_x_jz_l_x_b1_yi1jcm_vk_z_w50a_w_fscy5lc_h_vi/xhttps/ip127.0.0.1/p8000/EPUB/text/part0013_split_000.html?r2_GOTO=eyJjZmkiOiIvNC84IiwiY3NzU2VsZWN0b3IiOiIuY2VudGVyIn0%3D&r2_CSS=e30%3D&r2_ERS=eyJuYW1lIjoiUmVhZGl1bTIgdGVzdCBhcHAiLCJ2ZXJzaW9uIjoiMC4wLjEtYWxwaGEuMSJ9&r2_DEBUG=false&r2_CLIPBOARD_INTERCEPT=false&r2_WEBVIEW_SLOT=center&r2_SECOND_WEBVIEW=0. Domains, protocols and ports must match.

I've finally found the problem that kept my text books from working on Ipads for years. Fuck yeah.

This of course doesn't fix the local storage namespace collision but since it's flawed that needs to be changed as well.