TypeError on Android
See original GitHub issueUsing 3.10.6 (copied form the repo today, bc003e6 )
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript" src="brython.js"></script>
<title id="title"> Brython Audio Test</title>
</head>
<body lang="en-US" onload="brython({debug:1, indexedDB:0})" >
<audio id="music_player">
<source src="song1.mp3" type="audio/mpeg">
</audio>
<button type="button" id="play_button"> Play </button>
<button type="button" id="song1"> Song 1 </button>
<button type="button" id="song2"> Song 2 </button>
<script type="text/python">
from browser import document as doc
from browser import bind
def play(event):
doc['music_player'].play()
def change(event):
song_url = event.target.id+'.mp3'
music_player = doc['music_player']
music_player.src = song_url
music_player.load()
music_player.play()
doc['play_button'].bind('click', play)
doc['song1'].bind('click', change)
doc['song2'].bind('click', change)
</script>
</body>
</html>
This is a small example of how I wanted to play some audio in the browser. This works fine on Firefox and Chrome on Windows10, but gives out a Type error when trying to run on Android. Chrome and Firefox on Android has no console, so I can’t tell if the error is the same there, but Kiwi Browser (a chrome clone) spits out this and plays nothing:
TypeError: Cannot read properties of undefined (reading 'split')
at warn (brython.js:13128:47)
at DOMNode.__setattr__ (brython.js:13141:48)
at Object.$B.$setattr (brython.js:6916:1)
at change6 (eval at $B.loop (brython.js:4588:12), <anonymous>: 90:4)
at HTMLButtonElement.<anonymouse> (brython.js:13154:58)
I would normally say it’s an Android quirk, can’t be helped, but this code used to work back on 3.10.4 (can’t say what exact version, but I still have the brython.js saved locally - so maybe there’s a way to extract any more details from it - I just don’t know how).
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
ERROR TypeError: ["Android"].showToast is not a function ...
I am loading the webpage in webview using WebChromeClient(). The webpage has a dropdown whenever the user select's item from that dropdown I ......
Read more >TypeError on Android | RPG Maker Forums
Hello everybody! I downloaded from Steam RPG Maker MV (version 1.5). I have some problems when I try to play in an Android...
Read more >TypeError: Network request failed On Android #25244 - GitHub
Hi Everyone, I found this problem on my React-Native Android App. When I using a fetch to communicate with a working api, this...
Read more >Cordova Build android. TypeError: Cannot read property ...
Hi , I've created a pipeline that Build in angular but all task runs fine before cordova build task and finally get an...
Read more >Android apps build failing - Build issue - AppGyver forums
TypeError : /tmp/596948-android-252041/src/entry/index.android.ts: isTSSatisfiesExpression is not a function at Object.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for the fix. I can confirm it works now.
Many thanks for the detailed report @shark-in-a-hat, it was very helpful.
I could reproduce the bug on my mobile and I think the commit above fixes it. Can you confirm ?